l-hammer/YDTemplate

View on GitHub

Showing 23 of 62 total issues

Function replace has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

  [replace](node) {
    const con = node.textContent;
    const reg = /\{\{(.*?)\}\}/;
    // 元素节点
    if (node.nodeType === 1) {
Severity: Minor
Found in src/vetar/index.js - 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 Preloadimages has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Preloadimages(configs) {
  this.total = this.option.resources.length || 0; // 资源总数
  this.currentIndex = 0; // 当前加载资源索引
  this.option = {
    baseUrl: './', // 资源基准url, 默认'./'
Severity: Major
Found in src/utils/es5/preloadimages.js - About 2 hrs to fix

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

      observe(data) {
        const dep = new Dep();
        for (const key in data) {
          if ({}.hasOwnProperty.call(data, key)) {
            let val = data[key];
    Severity: Minor
    Found in src/vetar/index.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 Preloadimages has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    function Preloadimages(configs) {
      this.total = this.option.resources.length || 0; // 资源总数
      this.currentIndex = 0; // 当前加载资源索引
      this.option = {
        baseUrl: './', // 资源基准url, 默认'./'
    Severity: Minor
    Found in src/utils/es5/preloadimages.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 wxShare has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const wxShare = (configs, share = {}) => {
      wx.config({
        debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
        // appId: configs.appid, // 必填,公众号的唯一标识
        // timestamp: configs.timestamp, // 必填,生成签名的时间戳
    Severity: Minor
    Found in src/utils/es6/wxShare.js - About 2 hrs to fix

      Function replace has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        [replace](node) {
          const con = node.textContent;
          const reg = /\{\{(.*?)\}\}/;
          // 元素节点
          if (node.nodeType === 1) {
      Severity: Minor
      Found in src/vetar/index.js - About 1 hr to fix

        Function jsonp has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function jsonp(opt) {
          return new Promise((resolve, reject) => {
            let
              body = null,
              handler = null;
        Severity: Minor
        Found in src/utils/es6/fetch.js - About 1 hr to fix

          Function parse has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const parse = (dateStr, mask) => {
            let isVaild = true;
            const dateInfo = {};
            const today = new Date();
          
          
          Severity: Minor
          Found in src/utils/es6/date.js - About 1 hr to fix

            Function success has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  success() {
                    /**
                     * 发送给朋友
                     */
                    wx.onMenuShareAppMessage({
            Severity: Minor
            Found in src/utils/es6/wxShare.js - About 1 hr to fix

              Function viewType has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const viewType = (val) => {
                if (val === null) return 'null';
              
                const type = typeof val;
                switch (type) {
              Severity: Minor
              Found in src/utils/es6/viewType.js - About 1 hr to fix

                Function viewType has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                export const viewType = (val) => {
                  if (val === null) return 'null';
                
                  const type = typeof val;
                  switch (type) {
                Severity: Minor
                Found in src/utils/es6/viewType.js - About 55 mins 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

                Avoid deeply nested control flow statements.
                Open

                        with open(packageFile + '.less', 'w') as g:
                          for line in f.readlines():
                            if not isInArray(mvegarr, line):
                              g.write(line)
                      shutil.move(packageFile + '.less', packageFile)
                Severity: Major
                Found in bin/mvuseless.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                              if (eventType && fn) {
                                node.addEventListener(eventType, fn.bind(this), false);
                              }
                  Severity: Major
                  Found in src/vetar/index.js - About 45 mins to fix

                    Function constructor has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      constructor(configs) {
                        this.total = this.option.resources.length || 0; // 资源总数
                        this.currentIndex = 0; // 当前加载资源索引
                        this.option = {
                          baseUrl: './', // 资源基准url, 默认'./'
                    Severity: Minor
                    Found in src/utils/es6/preloadimages.js - About 45 mins 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

                    Avoid deeply nested control flow statements.
                    Open

                            for line in lines:
                              s.write(line.replace('npm run webbuild && npm run appbuild', npmdist))
                          with open(packageFile, 'r') as f:
                    Severity: Major
                    Found in bin/mvuseless.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                              with open(packageFile + '.less', 'w') as g:
                                for line in f.readlines():
                                  if not isInArray(mvarr, line):
                                    g.write(line)
                            shutil.move(packageFile + '.less', packageFile)
                      Severity: Major
                      Found in bin/mvuseless.py - About 45 mins to fix

                        Function formatParams has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function formatParams(data) {
                          const params = [];
                        
                          if (isObject(data)) {
                            for (const key in data) {
                        Severity: Minor
                        Found in src/utils/es6/fetch.js - About 35 mins 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

                        Avoid too many return statements within this function.
                        Open

                          return false;
                        Severity: Major
                        Found in src/utils/es6/viewType.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return ctorName(val).toLowerCase();
                          Severity: Major
                          Found in src/utils/es6/viewType.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                              if (isPlainObject(val)) return 'object';
                            Severity: Major
                            Found in src/utils/es6/viewType.js - About 30 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language