dschadow/ApplicationIntrusionDetection

View on GitHub

Showing 10 of 39 total issues

Method validate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public void validate(final Object target, final Errors errors) {
        validator.validate(target, errors);

        SearchFilter filter = (SearchFilter) target;

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

    @Override
    public void validate(final Object target, final Errors errors) {
        validator.validate(target, errors);

        DukeEncountersUser user = (DukeEncountersUser) target;

    Method validate has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Override
        public void validate(final Object target, final Errors errors) {
            validator.validate(target, errors);
    
            SearchFilter filter = (SearchFilter) target;

      Method toString has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @Override
          public String toString() {
              StringBuilder searchFilterString = new StringBuilder();
              if (!Strings.isNullOrEmpty(getEvent())) {
                  searchFilterString.append("Event: ");

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

            @Override
            public void validate(final Object target, final Errors errors) {
                validator.validate(target, errors);
        
                DukeEncountersUser user = (DukeEncountersUser) target;

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

            @Override
            protected void configure(final HttpSecurity http) throws Exception {
                // @formatter:off
                http
                    .authorizeRequests()

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

              @Override
              public String toString() {
                  StringBuilder searchFilterString = new StringBuilder();
                  if (!Strings.isNullOrEmpty(getEvent())) {
                      searchFilterString.append("Event: ");

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

              public static Likelihood fromString(String value) {
                  if (!Strings.isNullOrEmpty(value)) {
                      for (Likelihood l : Likelihood.values()) {
                          if (value.equals(l.toString())) {
                              return l;

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

              protected void validateBaseData(final String event, final String location, final String country,
                                              final Errors errors) {
                  if (securityValidationService.hasXssPayload(event)) {
                      fireXssEvent();
                      errors.rejectValue("event", Constants.XSS_ERROR_CODE);

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

              public List<Encounter> getEncounters(@NotNull final SearchFilter filter) {
                  List<Specification> specifications = new ArrayList<>();
          
                  String event = Constants.LIKE;
                  if (!Strings.isNullOrEmpty(filter.getEvent())) {

          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