maskletter/tenp

View on GitHub

Showing 39 of 62 total issues

Function __generator has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
Open

var __generator = (this && this.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
Severity: Minor
Found in core/dist/lib/plugin/receive.plugin.js - About 1 day to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function __generator has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
Open

var __generator = (this && this.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
Severity: Minor
Found in core/dist/lib/server.js - About 1 day to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function __generator has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
Open

var __generator = (this && this.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
Severity: Minor
Found in core/dist/lib/plugin/interceptor.plugin.js - About 1 day to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function __generator has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
Open

var __generator = (this && this.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
Severity: Minor
Found in core/dist/lib/event.js - About 1 day to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function ValidatorPlugin has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

var ValidatorPlugin = /** @class */ (function () {
    function ValidatorPlugin() {
        this.defaultType = {
            phone: /^1[34578]\d{9}$/,
            email: /^[a-z0-9]+([._\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/
Severity: Minor
Found in core/dist/lib/plugin/validator.plugin.js - About 6 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function validator has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    private validator(data: any, validator: Validator, request: tenp.Request, response: tenp.Response): boolean {
        const done = validator.done ? validator.done : this.globalDone ? this.globalDone : this.defaultDone;
        let result: boolean = false;
        for(let name in validator){
            if(name == 'done') continue;
Severity: Minor
Found in core/lib/plugin/validator.plugin.ts - About 3 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function ValidatorPlugin has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var ValidatorPlugin = /** @class */ (function () {
    function ValidatorPlugin() {
        this.defaultType = {
            phone: /^1[34578]\d{9}$/,
            email: /^[a-z0-9]+([._\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/
Severity: Major
Found in core/dist/lib/plugin/validator.plugin.js - About 2 hrs to fix

    Function InterceptorPlugin has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var InterceptorPlugin = /** @class */ (function () {
        function InterceptorPlugin() {
            this.globalInterceptor = [];
            this.routerInterceptor = [];
        }
    Severity: Major
    Found in core/dist/lib/plugin/interceptor.plugin.js - About 2 hrs to fix

      Function ReceivePlugin has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var ReceivePlugin = /** @class */ (function () {
          function ReceivePlugin(argument) {
              // code...
          }
          //Default receiving rule
      Severity: Major
      Found in core/dist/lib/plugin/receive.plugin.js - About 2 hrs to fix

        Function exports has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function(argv){
        
            const isNo = argv.indexOf('--no') == -1 ? false : true;
            argv = argv.filter(v => v != '--no');
            const name = argv[0];
        Severity: Major
        Found in cli/lib/init.js - About 2 hrs to fix

          Function start has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

          module.exports.start = function(argv){
              if(!tsconfig.compilerOptions) return con.error('\r\n $ 未发现tsconfig配置文件');
          
              const outDir = path.join(cwd, tsconfig.compilerOptions.outDir);
              
          Severity: Minor
          Found in cli/lib/pm2.js - About 2 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function tsWatch has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function tsWatch(process_server, error){
          
              let CompileError = false;
              var configPath = ts.findConfigFile(
          
          
          Severity: Minor
          Found in cli/lib/dev.js - About 1 hr to fix

            Function start has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports.start = function(argv){
                if(!tsconfig.compilerOptions) return con.error('\r\n $ 未发现tsconfig配置文件');
            
                const outDir = path.join(cwd, tsconfig.compilerOptions.outDir);
                
            Severity: Minor
            Found in cli/lib/pm2.js - About 1 hr to fix

              Function validator has 44 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  ValidatorPlugin.prototype.validator = function (data, validator, request, response) {
                      var done = validator.done ? validator.done : this.globalDone ? this.globalDone : this.defaultDone;
                      var result = false;
                      for (var name_1 in validator) {
                          if (name_1 == 'done')
              Severity: Minor
              Found in core/dist/lib/plugin/validator.plugin.js - About 1 hr to fix

                Function createPackage has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                async function createPackage(name){
                    console.log('create init')
                    let pacakge = {};
                    pacakge.name = await readlinePromise(`  package name: (${name})`) || name;
                    const validateresult = validate(pacakge.name);
                Severity: Minor
                Found in cli/lib/init.js - About 1 hr to fix

                  Function InterceptorPlugin has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                  var InterceptorPlugin = /** @class */ (function () {
                      function InterceptorPlugin() {
                          this.globalInterceptor = [];
                          this.routerInterceptor = [];
                      }
                  Severity: Minor
                  Found in core/dist/lib/plugin/interceptor.plugin.js - About 1 hr to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function InjectorPlugin has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  var InjectorPlugin = /** @class */ (function () {
                      function InjectorPlugin() {
                          this.globalProvide = {};
                      }
                      InjectorPlugin.prototype.onTenp = function (config) {
                  Severity: Minor
                  Found in core/dist/lib/plugin/injector.plugin.js - About 1 hr to fix

                    Function defaultReceive has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        ReceivePlugin.prototype.defaultReceive = function (request) {
                            var contentType = request.headers['content-type'];
                            if (contentType.indexOf('multipart/form-data;') != -1) {
                                return new Promise(function (resolve, reject) {
                                    var form = new formidable.IncomingForm();
                    Severity: Minor
                    Found in core/dist/lib/plugin/receive.plugin.js - About 1 hr to fix

                      Function tsWatch has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function tsWatch(process_server, error){
                      
                          let CompileError = false;
                          var configPath = ts.findConfigFile(
                      
                      
                      Severity: Minor
                      Found in cli/lib/dev.js - About 1 hr to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function writeFile has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      ts.sys.writeFile = function(fileName, data, writeByteOrderMark) {
                            // If a BOM is required, emit one
                            if (writeByteOrderMark) {
                                data = byteOrderMarkIndicator + data;
                            }
                      Severity: Minor
                      Found in cli/lib/dev.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language