Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
代码在github页面上的格式不好_Github - Fatal编程技术网

代码在github页面上的格式不好

代码在github页面上的格式不好,github,Github,例如,我有以下代码 我在vim中使用了2个空格,它在vim中运行良好。当代码在github上时,它不是格式化的。有人知道怎么解决吗?在github页面中,代码如下所示 'use strict'; const Employee = require('./Employee'); const Util = require('./Util'); let util = new Util(); let Processor = function() {}; Processor.prototype.pr

例如,我有以下代码

我在vim中使用了2个空格,它在vim中运行良好。当代码在github上时,它不是格式化的。有人知道怎么解决吗?在github页面中,代码如下所示

'use strict';

const Employee = require('./Employee');
const Util = require('./Util');

let util = new Util();
let Processor = function() {};

Processor.prototype.process = async function(taxObj, csvArr, fileName='../data/output.csv') {
    DEBUG && console.log('process');

    let item;
    let currTaxObj;
    let rightTaxSlot;
    let edge;
    let base;
    let taxRate;
    let buf = [];
    let employee;

    csvArr.map((item) => {
        employee = new Employee();

        // fill employee model
    employee.firstName = item.firstName;
    employee.lastName = item.lastName;
    employee.annualSalary = item.annualSalary;
    employee.superRate = util.percentToNum(item.superRate);
    employee.timePeriod = item.timePeriod;
    employee.startPeriod = util.parseTimePeriod(item.timePeriod)[0] + ' ' + TIME_PERIOD_YEAR;
    employee.endPeriod = util.parseTimePeriod(item.timePeriod)[1] + ' ' + TIME_PERIOD_YEAR;

        // get right tax slot
    currTaxObj = util.getTaxData(taxObj, employee.startPeriod, employee.endPeriod);
    rightTaxSlot = util.getRightTaxSlot(currTaxObj, employee.annualSalary);

    employee.grossIncome = util.buildGrossIncome(employee.annualSalary);
    employee.fullName = employee.buildFullName();

    // build income tax
    base = rightTaxSlot['base'];
    edge = rightTaxSlot['edge'];
    taxRate = rightTaxSlot['rate'];

    employee.incomeTax = util.buildIncomeTax(employee.annualSalary, base, edge, taxRate);
    employee.netIncome = util.buildNetIncome(employee.grossIncome, employee.incomeTax);
    employee.mySuper = util.buildMySuper(employee.grossIncome, employee.superRate);

    buf.push(employee); 
    }); 

    return await util.print(buf, fileName);
}

module.exports = Processor;

我在您的GitHub页面中没有看到任何格式问题。
评论是正确对齐的

我检查了任何表格而不是空格,但没有任何更改(意味着只使用空格)

检查您的帐户。

特别是GitHub上的
set tabstop=4
set expandtab

空间是4,他需要它2@RohitDhiman你停下来了吗?(如中所示,但使用2而不是4)我将其设置为tab到4个空格。“现在好了!”彼得大帝!别忘了读,看看这个