lynrin/cordova-plugin-buildinfo

View on GitHub

Showing 13 of 13 total issues

Function init has 96 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    init: function (successCallback, errorCallback, args) {
        var self = BuildInfoProxy;

        if (null !== self._cache) {
            successCallback(self._cache);
Severity: Major
Found in src/windows/BuildInfoProxy.js - About 3 hrs to fix

    Method init has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private void init(String buildConfigClassName, CallbackContext callbackContext) {
            // Cached check
            if (null != mBuildInfoCache) {
                callbackContext.success(mBuildInfoCache);
                return;
    Severity: Major
    Found in src/android/BuildInfo.java - About 2 hrs to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                      if ('undefined' !== typeof res.installDate) {
                          if (res.installDate instanceof Date) {
                              module.exports.installDate = res.installDate;
                          } else {
                              module.exports.installDate = new Date(res.installDate);
      Severity: Major
      Found in www/buildinfo.js and 1 other location - About 2 hrs to fix
      www/buildinfo.js on lines 133..139

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 78.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                      if ('undefined' !== typeof res.buildDate) {
                          if (res.buildDate instanceof Date) {
                              module.exports.buildDate = res.buildDate;
                          } else {
                              module.exports.buildDate = new Date(res.buildDate);
      Severity: Major
      Found in www/buildinfo.js and 1 other location - About 2 hrs to fix
      www/buildinfo.js on lines 141..147

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 78.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          if (projitems.match(/<ItemGroup>[\s]*?<Content +.*?Include="strings\/buildinfo.resjson".+/m)) {
              const search = /<ItemGroup>[\s]*?<Content +.*?Include="strings\/buildinfo.resjson"[\s\S]*?<\/ItemGroup>/m;
      
              const replace
                  = "<ItemGroup>\r\n"
      Severity: Major
      Found in scripts/after_install.js and 1 other location - About 1 hr to fix
      scripts/before_uninstall.js on lines 36..47

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 64.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          if (projitems.match(/<ItemGroup>[\s]*?<PRIResource +.*?Include="strings\/buildinfo.resjson".+/m)) {
      
              const search = /<ItemGroup>[\s]*?<PRIResource +.*?Include="strings\/buildinfo.resjson"[\s\S]*?<\/ItemGroup>/m;
      
              const replace
      Severity: Major
      Found in scripts/before_uninstall.js and 1 other location - About 1 hr to fix
      scripts/after_install.js on lines 37..47

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 64.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

      function installWindows(windowsPath) {
      
          const targetPath = path.join(windowsPath, 'CordovaApp.projitems');
          let projitems = fs.readFileSync(targetPath).toString();
          let changed = false;
      Severity: Minor
      Found in scripts/after_install.js - About 1 hr to fix

        Function init has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            init: function (successCallback, errorCallback, args) {
                var self = BuildInfoProxy;
        
                if (null !== self._cache) {
                    successCallback(self._cache);
        Severity: Minor
        Found in src/windows/BuildInfoProxy.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

        Method init has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            private void init(String buildConfigClassName, CallbackContext callbackContext) {
                // Cached check
                if (null != mBuildInfoCache) {
                    callbackContext.success(mBuildInfoCache);
                    return;
        Severity: Minor
        Found in src/android/BuildInfo.java - 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 rewriteBuildInfoProxy has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function rewriteBuildInfoProxy(context, pathPrefix) {
        
            const opts = context.opts || {};
            const options = opts.options || {};
            const release = options.release || false;
        Severity: Minor
        Found in scripts/browser_after_prepare.js - About 1 hr to fix

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

              private static boolean getClassFieldBoolean(Class c, String fieldName, boolean defaultReturn) {
                  boolean ret = defaultReturn;
                  Field field = getClassField(c, fieldName);
          
                  if (null != field) {
          Severity: Major
          Found in src/android/BuildInfo.java and 2 other locations - About 55 mins to fix
          src/android/BuildInfo.java on lines 230..243
          src/android/BuildInfo.java on lines 252..265

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 66.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

              private static int getClassFieldInt(Class c, String fieldName, int defaultReturn) {
                  int ret = defaultReturn;
                  Field field = getClassField(c, fieldName);
          
                  if (null != field) {
          Severity: Major
          Found in src/android/BuildInfo.java and 2 other locations - About 55 mins to fix
          src/android/BuildInfo.java on lines 186..199
          src/android/BuildInfo.java on lines 252..265

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 66.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

              private static long getClassFieldLong(Class c, String fieldName, long defaultReturn) {
                  long ret = defaultReturn;
                  Field field = getClassField(c, fieldName);
          
                  if (null != field) {
          Severity: Major
          Found in src/android/BuildInfo.java and 2 other locations - About 55 mins to fix
          src/android/BuildInfo.java on lines 186..199
          src/android/BuildInfo.java on lines 230..243

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 66.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Severity
          Category
          Status
          Source
          Language