nstickney/CyBearPit

View on GitHub

Showing 84 of 84 total issues

Resource has 30 methods (exceeds 20 allowed). Consider refactoring.
Open

@Entity
public class Resource extends AbstractComparableByContest {

    public static final String DNS = "DNS";
    public static final String HTTP = "HTTP";
Severity: Minor
Found in beanpoll/src/main/java/is/stma/beanpoll/model/Resource.java - About 3 hrs to fix

    Method call has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        @Override
        public String call() {
            while (contest.isEnabled()) {
    
                // Check to see if it's time to start actually polling this contest
    Severity: Minor
    Found in beanpoll/src/main/java/is/stma/beanpoll/poller/JudgeCallable.java - About 2 hrs 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

    Contest has 23 methods (exceeds 20 allowed). Consider refactoring.
    Open

    @Entity
    public class Contest extends AbstractEntity {
    
        @Column(nullable = false, unique = true)
        private String name;
    Severity: Minor
    Found in beanpoll/src/main/java/is/stma/beanpoll/model/Contest.java - About 2 hrs to fix

      Team has 23 methods (exceeds 20 allowed). Consider refactoring.
      Open

      @Entity
      public class Team extends AbstractComparableByContest {
      
          @Column(nullable = false)
          private String name;
      Severity: Minor
      Found in beanpoll/src/main/java/is/stma/beanpoll/model/Team.java - About 2 hrs to fix

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

            @Override
            void setParameters() {
        
                for (Parameter p : resource.getParameters()) {
                    switch (p.getTag()) {
        beanpoll/src/main/java/is/stma/beanpoll/poller/FTPPoller.java on lines 102..128

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

        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

            @Override
            void setParameters() {
                for (Parameter p : resource.getParameters()) {
                    switch (p.getTag()) {
                        case FTPParameterizer.FTP_RESOLVER:
        beanpoll/src/main/java/is/stma/beanpoll/poller/EmailPoller.java on lines 99..126

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

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

            public static String lookup(String hostAddress, int hostPort, String query, int type,
                                        boolean tcp, boolean recursive, int timeout, boolean firstOnly) {
                try {
        
                    // Set up the resolution options
        Severity: Minor
        Found in beanpoll/src/main/java/is/stma/beanpoll/util/DNSUtility.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 doPoll has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Override
            public Poll doPoll() {
        
                Poll newPoll = new Poll();
                newPoll.setResource(resource);
        Severity: Minor
        Found in beanpoll/src/main/java/is/stma/beanpoll/poller/FTPPoller.java - About 1 hr to fix

          Method compareTo has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              @Override
              public int compareTo(User o) {
          
                  // If one is an admin, but not the other, decide based on that
                  if (this.isAdmin() && !o.isAdmin()) {
          Severity: Minor
          Found in beanpoll/src/main/java/is/stma/beanpoll/model/User.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 checkTeamNameAndFlagAreUniqueInContest has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              private void checkTeamNameAndFlagAreUniqueInContest(Team entity) throws ValidationException {
                  if (null != entity.getContest()) {
                      List<Team> others = repo.findByContest(entity.getContest().getId());
                      for (Team t : others) {
                          if (!t.equalByUUID(entity)) {
          Severity: Minor
          Found in beanpoll/src/main/java/is/stma/beanpoll/rules/TeamRules.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 doPoll has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              @Override
              public Poll doPoll() {
          
                  Poll newPoll = new Poll();
                  newPoll.setResource(resource);
          Severity: Minor
          Found in beanpoll/src/main/java/is/stma/beanpoll/poller/FTPPoller.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 doPoll has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @Override
              public Poll doPoll() {
          
                  Poll newPoll = new Poll();
                  newPoll.setResource(resource);
          Severity: Minor
          Found in beanpoll/src/main/java/is/stma/beanpoll/poller/EmailPoller.java - About 1 hr to fix

            Method createParameters has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public List<Parameter> createParameters(Resource resource) throws ValidationException {
            
                    // Create the correct parameters for the resource
                    List<Parameter> parameters;
                    switch (resource.getType()) {

              Method lookup has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static String lookup(String hostAddress, int hostPort, String query, int type,
                                              boolean tcp, boolean recursive, int timeout, boolean firstOnly) {
                      try {
              
                          // Set up the resolution options
              Severity: Minor
              Found in beanpoll/src/main/java/is/stma/beanpoll/util/DNSUtility.java - About 1 hr to fix

                Method filterSupportedTypes has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private static String filterSupportedTypes(Record[] records, int type, boolean firstOnly) {
                        StringBuilder result = new StringBuilder();
                        for (Record r : records) {
                            switch (type) {
                                case A:
                Severity: Minor
                Found in beanpoll/src/main/java/is/stma/beanpoll/util/DNSUtility.java - About 1 hr to fix

                  Method doPoll has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      @Override
                      public Poll doPoll() {
                  
                          setParameters();
                  
                  
                  Severity: Minor
                  Found in beanpoll/src/main/java/is/stma/beanpoll/poller/SMTPPoller.java - About 1 hr to fix

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

                        @Override
                        public Poll doPoll() {
                    
                            Poll newPoll = new Poll();
                            newPoll.setResource(resource);
                    Severity: Minor
                    Found in beanpoll/src/main/java/is/stma/beanpoll/poller/HTTPPoller.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 createParameters has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public List<Parameter> createParameters(Resource resource) throws ValidationException {
                    
                            // Create the correct parameters for the resource
                            List<Parameter> parameters;
                            switch (resource.getType()) {

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

                        @Override
                        public Poll doPoll() {
                    
                            Poll newPoll = new Poll();
                            newPoll.setResource(resource);
                    Severity: Minor
                    Found in beanpoll/src/main/java/is/stma/beanpoll/poller/EmailPoller.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 compare has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        int compare(AbstractComparableByContest e1, AbstractComparableByContest e2) {
                    
                            // If both are assigned to contests, decide based on which contest is running
                            if (null != e1.getContest() && null != e2.getContest()) {
                    
                    

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language