jenkinsci/calendar-view-plugin

View on GitHub

Showing 3 of 9 total issues

Method getStartedEvents has a Cognitive Complexity of 25 (exceeds 10 allowed). Consider refactoring.
Open

    @SuppressWarnings("PMD.CyclomaticComplexity")
    public List<StartedCalendarEvent> getStartedEvents(final List<? extends Job> jobs, final MomentRange range, final CalendarEventState state, final CalendarViewEventsType eventsType) {
        if (state == CalendarEventState.SCHEDULED) {
            throw new IllegalArgumentException("State for started events cannot be " + CalendarEventState.SCHEDULED);
        }

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 getCronTriggers has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring.
Open

    @SuppressWarnings("PMD.CyclomaticComplexity")
    public List<Trigger> getCronTriggers(final Job job, final CalendarViewEventsType eventsType) {
        Collection<Trigger<?>> jobTriggers;
        if (job instanceof AbstractProject) {
            jobTriggers = ((AbstractProject)job).getTriggers().values();

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 getCronTabs has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring.
Open

    @SuppressWarnings("PMD.CyclomaticComplexity")
    public List<CronTab> getCronTabs(final Trigger trigger, final Hash hash) {
        final List<CronTab> cronTabs = new ArrayList<>();
        final boolean isParameterizedTrigger = PluginUtil.hasParameterizedSchedulerPluginInstalled()
                && trigger instanceof ParameterizedTimerTrigger;

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