creative-workflow/pi-setup

View on GitHub

Showing 116 of 116 total issues

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

  def config_ini(self, remote_file = None, *args, **kwargs):
    if remote_file: remote_file = self.service.normalize_path(remote_file)
    return RemoteConfigIniLoader(self.service, remote_file, *args, **kwargs)
Severity: Major
Found in lib/piservices/remote/integration.py and 3 other locations - About 1 hr to fix
lib/piservices/remote/integration.py on lines 46..48
lib/piservices/remote/integration.py on lines 50..52
lib/piservices/remote/integration.py on lines 54..56

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 40.

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 cookie has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var config = $.cookie = function (key, value, options) {

        // Write

        if (value !== undefined && !$.isFunction(value)) {
Severity: Minor
Found in services/pisound/src/web/htdocs/js/jquery.cookie.js - About 1 hr to fix

    Function checkPosition has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      Affix.prototype.checkPosition = function () {
        if (!this.$element.is(':visible')) return
    
        var scrollHeight = $(document).height()
        var scrollTop    = this.$window.scrollTop()
    Severity: Minor
    Found in services/pisound/src/web/htdocs/js/bootstrap.js - About 1 hr to fix

      Function redirect has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          redirect: function() {
            var to, args = _makeArray(arguments),
                current_location = this.app.getLocation(),
                l = args.length;
            if (l > 1) {
      Severity: Minor
      Found in services/pisound/src/web/htdocs/js/sammy.js - About 1 hr to fix

        Function backdrop has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          Modal.prototype.backdrop = function (callback) {
            var animate = this.$element.hasClass('fade') ? 'fade' : ''
        
            if (this.isShown && this.options.backdrop) {
              var doAnimate = $.support.transition && animate
        Severity: Minor
        Found in services/pisound/src/web/htdocs/js/bootstrap.js - About 1 hr to fix

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

                              if(obj.data.album) {
                                  $('#album').text(obj.data.album);
                                  notification += obj.data.album + "<br />";
                              }
          Severity: Major
          Found in services/pisound/src/web/htdocs/js/mpd.js and 1 other location - About 1 hr to fix
          services/pisound/src/web/htdocs/js/mpd.js on lines 355..358

          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 57.

          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(obj.data.artist) {
                                  $('#artist').text(obj.data.artist);
                                  notification += obj.data.artist + "<br />";
                              }
          Severity: Major
          Found in services/pisound/src/web/htdocs/js/mpd.js and 1 other location - About 1 hr to fix
          services/pisound/src/web/htdocs/js/mpd.js on lines 351..354

          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 57.

          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 get has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def get(self, key):
              if not key in self.content:
                return None
          
              lines = self.content.splitlines()
          Severity: Minor
          Found in lib/piservices/remote/config.py - 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 deploy has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def deploy(self, restart=False):
              """run upgrade and clean on the pi"""
              PiService.deploy(self, False)
          
              self._udhcpd_default_write(self.config.enabled)
          Severity: Minor
          Found in services/udhcpd/__init__.py - 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 unset has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def unset(self, key):
              lines = self.content.splitlines()
              nr = -1
              for line in lines:
                nr+=1
          Severity: Minor
          Found in lib/piservices/remote/config.py - 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 load_tests has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          def load_tests(loader, tests, pattern):
            suite = unittest.TestSuite()
          
            pattern='test_*.py'
            for dirname, dirnames, filenames in os.walk(tests_folder):
          Severity: Minor
          Found in test.py - 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 run has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              run: function(start_url) {
                if (this.isRunning()) { return false; }
                var app = this;
          
                // actually bind all the listeners
          Severity: Minor
          Found in services/pisound/src/web/htdocs/js/sammy.js - About 1 hr to fix

            Function activate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              Tab.prototype.activate = function (element, container, callback) {
                var $active    = container.find('> .active')
                var transition = callback
                  && $.support.transition
                  && $active.hasClass('fade')
            Severity: Minor
            Found in services/pisound/src/web/htdocs/js/bootstrap.js - About 1 hr to fix

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

                var Notification = function (element, options) {
                  // Element collection
                  this.$element = $(element);
                  this.$note    = $('<div class="alert"></div>');
                  this.options  = $.extend(true, {}, $.fn.notify.defaults, options);
              Severity: Minor
              Found in services/pisound/src/web/htdocs/js/bootstrap-notify.js - About 1 hr to fix

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

                    prependTo: function(selector) {
                      return this.then(function(content) {
                        $(selector).prepend(content);
                      }).trigger('changed', {});
                    },
                Severity: Major
                Found in services/pisound/src/web/htdocs/js/sammy.js and 1 other location - About 1 hr to fix
                services/pisound/src/web/htdocs/js/sammy.js on lines 1883..1887

                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 55.

                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

                  def get_fixture_path(self, name):
                    return os.path.dirname(os.path.realpath(__file__))+'/../../tests/fixtures/'+name
                Severity: Major
                Found in lib/tests.py and 1 other location - About 1 hr to fix
                lib/tests.py on lines 17..18

                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 38.

                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 4 locations. Consider refactoring.
                Open

                $('#btnrepeat').on('click', function (e) {
                    socket.send("MPD_API_TOGGLE_REPEAT," + ($(this).hasClass('active') ? 0 : 1));
                });
                Severity: Major
                Found in services/pisound/src/web/htdocs/js/mpd.js and 3 other locations - About 1 hr to fix
                services/pisound/src/web/htdocs/js/mpd.js on lines 480..483
                services/pisound/src/web/htdocs/js/mpd.js on lines 484..487
                services/pisound/src/web/htdocs/js/mpd.js on lines 488..490

                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 55.

                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 4 locations. Consider refactoring.
                Open

                $('#btnrandom').on('click', function (e) {
                    socket.send("MPD_API_TOGGLE_RANDOM," + ($(this).hasClass('active') ? 0 : 1));
                
                });
                Severity: Major
                Found in services/pisound/src/web/htdocs/js/mpd.js and 3 other locations - About 1 hr to fix
                services/pisound/src/web/htdocs/js/mpd.js on lines 484..487
                services/pisound/src/web/htdocs/js/mpd.js on lines 488..490
                services/pisound/src/web/htdocs/js/mpd.js on lines 491..493

                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 55.

                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

                  def get_shared_fixture_path(self, name):
                    return os.path.dirname(os.path.realpath(__file__))+'/tests/fixtures/'+name
                Severity: Major
                Found in lib/tests.py and 1 other location - About 1 hr to fix
                lib/tests.py on lines 20..21

                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 38.

                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 4 locations. Consider refactoring.
                Open

                $('#btnsingle').on('click', function (e) {
                    socket.send("MPD_API_TOGGLE_SINGLE," + ($(this).hasClass('active') ? 0 : 1));
                });
                Severity: Major
                Found in services/pisound/src/web/htdocs/js/mpd.js and 3 other locations - About 1 hr to fix
                services/pisound/src/web/htdocs/js/mpd.js on lines 480..483
                services/pisound/src/web/htdocs/js/mpd.js on lines 484..487
                services/pisound/src/web/htdocs/js/mpd.js on lines 491..493

                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 55.

                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