oglimmer/lunchy

View on GitHub

Showing 64 of 111 total issues

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

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

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

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

                  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 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 values has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public UsersPicturesVotesRecord values(Integer value1, Integer value2, Integer value3, Integer value4, Timestamp value5) {

                      Method writeChunkToFile has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          private void writeChunkToFile(HttpServletRequest req, long flowChunkNumber, long flowChunkSize, long flowTotalSize, File originalFile)
                      Severity: Minor
                      Found in src/main/java/de/oglimmer/lunchy/web/servlet/UploadServlet.java - About 35 mins to fix

                        Method updateGeoData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                                private void updateGeoData(LocationRecord locationRec) {
                                    if (!keepManuallyUpdatedGeoData) {
                                        try {
                                            String address = locationRec.getAddress() + "," + (locationRec.getZip() != null ? locationRec.getZip() : "")
                                                    + " " + locationRec.getCity() + "," + locationRec.getCountry();
                        Severity: Minor
                        Found in src/main/java/de/oglimmer/lunchy/rest/resources/LocationResource.java - About 35 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 doFilter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                                public void doFilter(FilterChain chain) throws IOException, ServletException {
                                    if (redirectToSecureNeeded()) {
                                        redirectToSecure();
                                    } else {
                                        if (isCallToRuntimeRestInterface()) {
                        Severity: Minor
                        Found in src/main/java/de/oglimmer/lunchy/web/servlet/CommunityFilter.java - About 35 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 getLongTermSessionCookie has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public Cookie getLongTermSessionCookie(HttpServletRequest httpReq) {
                                if (httpReq != null && httpReq.getCookies() != null) {
                                    for (Cookie coo : httpReq.getCookies()) {
                                        if ("LTS".equals(coo.getName())) {
                                            return coo;
                        Severity: Minor
                        Found in src/main/java/de/oglimmer/lunchy/services/CookieService.java - About 35 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 a Cognitive Complexity of 7 (exceeds 5 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 35 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 isValid has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                                public boolean isValid() {
                                    if (isLongTimeTokenPresent()) {
                                        tryToLoadUserByToken();
                                        if (userFound()) {
                                            if (isLongTimeTokenYoungerThan3Month()) {
                        Severity: Minor
                        Found in src/main/java/de/oglimmer/lunchy/rest/resources/helper/LoginCheck.java - About 35 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

                        Avoid too many return statements within this function.
                        Open

                                return ('' + obj).toLowerCase().indexOf(text) > -1;
                        Severity: Major
                        Found in src/main/webapp/js/services.js - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language