oglimmer/lunchy

View on GitHub

Showing 110 of 110 total issues

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

    public ReviewsRecord values(Integer value1, Integer value2, Integer value3, String value4, Timestamp value5, Timestamp value6, Integer value7, String value8, Integer value9, Integer value10, Integer value11) {

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

        function loadTags() {        
            TagService.get({selectedOffice:$scope.data.selectedOffice.id}).then(function(data) {
                $scope.allTags = data;
            });
        }
    src/main/webapp/js/index/controllers/LunchyControllerAdd.js on lines 9..13

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

    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

        function loadTags() {
            TagService.get({selectedOffice:$scope.data.selectedOffice.id}).then(function(data) {
                $scope.allTags = data;
            });
        }
    Severity: Major
    Found in src/main/webapp/js/index/controllers/LunchyControllerAdd.js and 1 other location - About 1 hr to fix
    src/main/webapp/js/index/controllers/LunchyControllerViewEditLocation.js on lines 9..13

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

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

        var PasswordStrengthService = function(emptyAllowed) {
            
            this.passStrength = null;
            this.passStrengthClass = null;
            this.emptyAllowed = emptyAllowed ? true : false;
    Severity: Minor
    Found in src/main/webapp/js/services.js - About 1 hr to fix

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

          private void init() {
              sourceLocation = System.getProperty(LUNCHY_PROPERTIES);
              if (sourceLocation != null) {
                  try {
                      if (sourceLocation.startsWith("memory:")) {
      Severity: Minor
      Found in src/main/java/de/oglimmer/lunchy/services/LunchyProperties.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

      Method getPoolDSJMXName has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public static ObjectName getPoolDSJMXName() {
              try {
                  ObjectName registryName = new ObjectName("com.mchange.v2.c3p0:type=C3P0Registry,name=C3P0DBConnection");
                  MBeanInfo registry = mbs.getMBeanInfo(registryName);
                  for (MBeanAttributeInfo mba : registry.getAttributes()) {
      Severity: Minor
      Found in src/main/java/de/oglimmer/lunchy/services/MBeanService.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

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

              if (options.format === 'hex') {
                  return '#' + (isGrayscale ? gray(this.hash({length: 2})) : this.hash({length: 6}));
              }
      Severity: Major
      Found in src/integration/js/chance.js and 1 other location - About 1 hr to fix
      src/integration/js/chance.js on lines 570..572

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

      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 (options.format === 'shorthex') {
                  return '#' + (isGrayscale ? gray(this.hash({length: 1})) : this.hash({length: 3}));
              }
      Severity: Major
      Found in src/integration/js/chance.js and 1 other location - About 1 hr to fix
      src/integration/js/chance.js on lines 566..568

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

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

          public static String getHtml(UsersRecord rec, List<UpdatesQuery> updates, List<MailImage> images) {
              StringBuilder body = new StringBuilder("<html><head><meta charset='utf-8'><style>" + HEAD_STYLE + "</style></head><body style='" + BODY_STYLE
                      + "'>");
              body.append("<div id='main' style='" + CONTENT_DIV_STYLE + "'>");
              body.append("<h2>" + MessageFormat.format(greeting, rec.getDisplayname()) + "</h2>").append(BR);
      Severity: Minor
      Found in src/main/java/de/oglimmer/lunchy/email/NotificationEmailText.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 getData has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              getData: function($defer, params) {
                  
                  // HACK: seems like the first parameter of NgTableParams doesn't respect page 
                  if(initPage!=null) {
                      if(initPage!=params.page()){

        Method getText has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static String getText(UsersRecord rec, List<UpdatesQuery> updates, List<MailImage> images) {
                StringBuilder body = new StringBuilder();
                body.append(MessageFormat.format(greeting, rec.getDisplayname())).append(CR);
                body.append(CR);
                if (updates.isEmpty()) {
        Severity: Minor
        Found in src/main/java/de/oglimmer/lunchy/email/NotificationEmailText.java - About 1 hr to fix

          Function link has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                link: function(scope, elem, attr, ngModelCtrl) {
                    var fieldName = attr.unique;
                    if(fieldName!="email" && fieldName!="domain") {
                        console.log("unique needs to be email/domain"); return;
                    }
          Severity: Minor
          Found in src/main/webapp/js/directives.js - About 1 hr to fix

            Method fixRotation has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private BufferedImage fixRotation() throws IOException {
                    BufferedImage tmpImg = originalImage;
                    // http://sylvana.net/jpegcrop/exif_orientation.html
                    switch (getOrientation(getBufferedInputStream())) {
                    case 1:
            Severity: Minor
            Found in src/main/java/de/oglimmer/lunchy/image/ImageScaler.java - About 1 hr to fix

              Method store has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public void store(String action, String context, HttpServletRequest request, LongTimeToken longTimeToken) {
                      Timestamp timestamp = DateCalcService.getNow();
                      String ip = getRemoteIP(request);
                      String userAgent = request.getHeader("User-Agent");
                      Cookie ltsCookie = CookieService.INSTANCE.getLongTermSessionCookie(request);
              Severity: Minor
              Found in src/main/java/de/oglimmer/lunchy/database/dao/UsageDao.java - About 1 hr to fix

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

                    private void init() {
                        sourceLocation = System.getProperty(LUNCHY_PROPERTIES);
                        if (sourceLocation != null) {
                            try {
                                if (sourceLocation.startsWith("memory:")) {
                Severity: Minor
                Found in src/main/java/de/oglimmer/lunchy/services/LunchyProperties.java - About 1 hr to fix

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

                          return [{
                              coords: {
                                  latitude: officeObj.geoLat,
                                  longitude: officeObj.geoLng
                              },
                  src/main/webapp/js/index/controllers/LunchyControllerBrowseLocations.js on lines 24..34

                  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

                          $scope.officeMarker = [{
                              coords: {
                                  latitude: off.geoLat,
                                  longitude: off.geoLng
                              },
                  src/main/webapp/js/index/controllers/LunchyControllerViewTab.js on lines 48..58

                  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

                  Method run has a Cognitive Complexity of 10 (exceeds 5 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

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

                      public List<QueryResponse> query(Set<String> tags, Set<String> partners, Integer maxTime, Integer selectedMinRating, int fkCommunity,
                              Integer fkCurrentUser, int selectedOffice) {
                          Result<LocationRecord> locations = queryLocations(tags, maxTime, fkCommunity, selectedOffice);
                          Result<Record> reviews = queryReviews(partners, getLocationId(locations), fkCurrentUser);
                  
                  
                  Severity: Minor
                  Found in src/main/java/de/oglimmer/lunchy/database/dao/FinderDao.java - About 1 hr to fix

                    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
                      Severity
                      Category
                      Status
                      Source
                      Language