oglimmer/lunchy

View on GitHub

Showing 64 of 111 total issues

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

    public LocationRecord values(Integer value1, String value2, String value3, String value4, String value5, String value6, String value7, String value8, String value9, Integer value10, Timestamp value11, Timestamp value12, Integer value13, Double value14, Double value15, String value16, Integer value17, Integer value18, Byte value19, Integer value20) {

    Method getHtml has 57 lines of code (exceeds 25 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: Major
    Found in src/main/java/de/oglimmer/lunchy/email/NotificationEmailText.java - About 2 hrs to fix

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

          public UsersRecord values(Integer value1, String value2, String value3, String value4, Timestamp value5, Timestamp value6, Integer value7, String value8, Timestamp value9, String value10, Timestamp value11, Integer value12, Integer value13, Integer value14, Timestamp value15, Timestamp value16, String value17) {

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

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

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

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

            Method getRemoteIP has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                private String getRemoteIP(HttpServletRequest request) {
            //        System.out.println("*****************" + request.getRemoteAddr());
            //        for(Enumeration<String> headerNames = request.getHeaderNames() ; headerNames.hasMoreElements(); ) {
            //            String headerName = headerNames.nextElement();
            //            System.out.println(headerName + "=" + request.getHeader(headerName));
            Severity: Minor
            Found in src/main/java/de/oglimmer/lunchy/database/dao/UsageDao.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 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) {

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

                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

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

                        public void store(String action, String context, HttpServletRequest request, LongTimeToken longTimeToken) {
                            String userAgent = request.getHeader("User-Agent");
                            if(userAgent != null && userAgent.startsWith("kube-probe/")) {
                                // do not log the health-check
                                return;
                    Severity: Minor
                    Found in src/main/java/de/oglimmer/lunchy/database/dao/UsageDao.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 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

                            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