oglimmer/lunchy

View on GitHub

Showing 111 of 111 total issues

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

    Chance.prototype.weighted = function(arr, weights) {
        if (arr.length !== weights.length) {
            throw new RangeError("Chance: length of array and weights must match");
        }

Severity: Minor
Found in src/integration/js/chance.js - About 1 hr to fix

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

    package de.oglimmer.lunchy.web.servlet;
    
    import java.io.IOException;
    import java.io.Writer;
    
    
    Severity: Major
    Found in src/main/java/de/oglimmer/lunchy/web/servlet/ScriptTag.java and 1 other location - About 1 hr to fix
    src/main/java/de/oglimmer/lunchy/web/servlet/StylesTag.java on lines 1..25

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

    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

    package de.oglimmer.lunchy.web.servlet;
    
    import java.io.IOException;
    import java.io.Writer;
    
    
    Severity: Major
    Found in src/main/java/de/oglimmer/lunchy/web/servlet/StylesTag.java and 1 other location - About 1 hr to fix
    src/main/java/de/oglimmer/lunchy/web/servlet/ScriptTag.java on lines 1..25

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

    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

    Method queryRandom has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @GET
        @Produces(MediaType.APPLICATION_JSON)
        @Path("random")
        public List<QueryResponse> queryRandom(@Context HttpServletRequest request,
                @QueryParam(value = "inclTags") String inclTags, @QueryParam(value = "partner") String partner,
    Severity: Minor
    Found in src/main/java/de/oglimmer/lunchy/rest/resources/FinderResource.java - About 1 hr to fix

      Method run has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              public void run() {
                  File toWatch = new File(sourceLocation);
                  log.info("PropertyFileWatcher started");
                  try {
                      final Path path = FileSystems.getDefault().getPath(toWatch.getParent());
      Severity: Minor
      Found in src/main/java/de/oglimmer/lunchy/services/LunchyProperties.java - About 1 hr to fix

        Method values has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public PicturesRecord values(Integer value1, Integer value2, Integer value3, String value4, String value5, Timestamp value6, Integer value7, Integer value8) {

          Method getRegExFromJsonArray has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              private String getRegExFromJsonArray(JsonArray array) {
                  if (array.isEmpty()) {
                      return "";
                  }
                  StringBuilder buff = new StringBuilder();
          Severity: Minor
          Found in src/main/java/de/oglimmer/lunchy/services/LunchyProperties.java - 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

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

                      if (i >= this.N) { this.mt[0] = this.mt[this.N - 1]; i = 1; }
          Severity: Minor
          Found in src/integration/js/chance.js and 1 other location - About 55 mins to fix
          src/integration/js/chance.js on lines 1628..1628

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

          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

                  $scope.data.selectedOffice = _.find($scope.offices, function(office) { return office.id == $scope.data.fkBaseOffice; });
          src/main/webapp/js/index/controllers/LunchyControllerViewEditLocation.js on lines 41..41

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

          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

                      $scope.data.selectedOffice = _.find($scope.offices, function(office) { return office.id == $scope.data.fkOffice; });
          src/main/webapp/js/index/controllers/LunchyControllerSettings.js on lines 19..19

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

          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

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

                      if (i >= this.N) { this.mt[0] = this.mt[this.N - 1]; i = 1; }
          Severity: Minor
          Found in src/integration/js/chance.js and 1 other location - About 55 mins to fix
          src/integration/js/chance.js on lines 1636..1636

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

          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

          Method query has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public List<QueryResponse> query(Set<String> tags, Set<String> partners, Integer maxTime, Integer selectedMinRating, int fkCommunity,
                      Integer fkCurrentUser, int selectedOffice) {
          Severity: Major
          Found in src/main/java/de/oglimmer/lunchy/database/dao/FinderDao.java - About 50 mins to fix

            Method values has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public OfficesRecord values(Integer value1, String value2, Double value3, Double value4, Integer value5, Integer value6, String value7) {

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

                  $stateProvider.
                      state('greetings', {
                          url: '/greetings',
                          templateUrl: 'partials/portal/greetings.html',
                          controller: 'LunchyControllerPortalGreetings'
              Severity: Minor
              Found in src/main/webapp/js/portal/app.js and 1 other location - About 50 mins to fix
              src/main/webapp/js/index/app.js on lines 13..23

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

              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

              Method query has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      private Result<Record> query(int voteLimit, Integer startPos, Integer maxRows, Integer notFromLocation, Condition cond,
                              Integer userId) {
              Severity: Minor
              Found in src/main/java/de/oglimmer/lunchy/database/dao/UpdatesDao.java - About 45 mins to fix

                Method copyAllAttributes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static void copyAllAttributes(ObjectName on, JsonObject targetObject) {
                        try {
                            MBeanInfo mbi = mbs.getMBeanInfo(on);
                            for (MBeanAttributeInfo mbai : mbi.getAttributes()) {
                                Object attValue = mbs.getAttribute(on, mbai.getName());
                Severity: Minor
                Found in src/main/java/de/oglimmer/lunchy/services/MBeanService.java - 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

                Method savePermission has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    @POST
                    @Produces(MediaType.APPLICATION_JSON)
                    @Path("{id}/savePermission")
                    public ResultParam savePermission(@Context HttpServletRequest request, @PathParam("id") Integer id, PermissionInput input) {
                        SecurityProvider.INSTANCE.checkAdmin(request);
                Severity: Minor
                Found in src/main/java/de/oglimmer/lunchy/rest/resources/UserResource.java - 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

                Method query has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public <R extends Record> List<R> query(Table<R> table, Condition condition, SortField<?> orderedBy, Integer startPos, Integer limit,
                            Class<R> clazz) {
                Severity: Minor
                Found in src/main/java/de/oglimmer/lunchy/database/dao/DaoBackend.java - About 45 mins to fix

                  Method queryRandom has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public List<QueryResponse> queryRandom(@Context HttpServletRequest request,
                              @QueryParam(value = "inclTags") String inclTags, @QueryParam(value = "partner") String partner,
                              @QueryParam(value = "maxTime") Integer maxTime, @QueryParam(value = "minRating") Integer minRating,
                              @QueryParam(value = "selectedOffice") Integer selectedOffice) {
                  Severity: Minor
                  Found in src/main/java/de/oglimmer/lunchy/rest/resources/FinderResource.java - About 45 mins to fix

                    Method query has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public List<QueryResponse> query(@Context HttpServletRequest request,
                                @QueryParam(value = "inclTags") String inclTags, @QueryParam(value = "partner") String partner,
                                @QueryParam(value = "maxTime") Integer maxTime, @QueryParam(value = "minRating") Integer minRating,
                                @QueryParam(value = "selectedOffice") Integer selectedOffice) {
                    Severity: Minor
                    Found in src/main/java/de/oglimmer/lunchy/rest/resources/FinderResource.java - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language