sentilo/sentilo

View on GitHub

Showing 1,220 of 1,220 total issues

Method getAlertAdditionalFields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  public CatalogAdditionalFields getAlertAdditionalFields(final String alertId) {
    CatalogAdditionalFields additionalFields = alertAdditionalFieldsCache.get(alertId);

    if (additionalFields == null) {
      // The first step is to retrieve the component associated with alert {alertId}

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

  @Override
  public boolean equals(final Object obj) {
    if (this == obj) {
      return true;
    }

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

  public CatalogAdditionalFields getAdditionalFields(final String alertId) {
    CatalogAdditionalFields additionalFields = alertAdditionalFieldsCache.get(alertId);

    if (additionalFields == null) {
      // The first step is to retrieve the component associated with alert {alertId}

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

  @Override
  @Auditable(actionType = AuditingActionType.UPDATE)
  @Transactional
  public Collection<T> updateAll(final Collection<T> entities) {

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

  private static boolean _showAdminControls(final ActionType action, final CatalogDocument resource) {
    // Depending on the logged in user role, the page displayed and the resource's tenant owner the
    // admin controls (i.e. buttons to delete, create, acces to edit and save resources) will be
    // displayed.
    final CatalogUserDetails catalogUser = (CatalogUserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();

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

  @Override
  public void checkAccess(final AccessControlContext acc) {

    if (userDetailsService.getCatalogUserDetails() == null) {
      LOGGER.error("Anonymous users are not allowed to {} resources of type {}", acc.getAction().name(), acc.getResourceClass().getName());

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

  @Override
  public void removeProvider(final String providerId) {
    LOGGER.debug("Deleting provider {} from Redis", providerId);
    final Optional<Long> pid = sequenceUtils.getPid(providerId);
    if (pid.isPresent()) {

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

  protected void validateUnicityKeys(final ApiValidationResults results, final List<T> objects) {
    // Group by key ...
    final Map<String, List<T>> groupsByKey = new HashMap<String, List<T>>();

    // Group by name ...

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

  public void shutdown() {
    if (threadPool != null) {
      threadPool.shutdown();
      try {
        if (!threadPool.awaitTermination(shutdownSecondsTimeout, TimeUnit.SECONDS)) {

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

  private NotificationParams buildNotificationParams(final SentiloRequest request) {
    final SubscriptionMessage inputMessage = (SubscriptionMessage) readInternal(SubscriptionMessage.class, request);

    final String endpoint = inputMessage != null ? inputMessage.getEndpoint() : null;
    final String secret = inputMessage != null ? inputMessage.getSecretCallbackKey() : null;

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

  @Override
  @Metric(requestType = RequestType.PUT, eventType = EventType.DATA)
  public void setObservations(final DataInputMessage message) {
    final List<Observation> observations = message.getObservations();
    final RejectedResourcesContext rejectedContext = new RejectedResourcesContext();

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

  public static boolean isValidSubscription(final String topic) {
    boolean valid = false;

    if (StringUtils.hasText(topic)) {
      try {

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

Function refreshChartControlLabels has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

var refreshChartControlLabels = function(theNavData) {
    
    // This is a chart callback function
    // When data is loaded onto chart, calls this function
    // for update window labels

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

Function refreshChartControlLabels has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

var refreshChartControlLabels = function(theNavData) {
    
    // This is a chart callback function
    // When data is loaded onto chart, calls this function
    // for update window labels
Severity: Minor
Found in sentilo-catalog-web/src/main/webapp/static/js/sentilo/sensor_data.js - About 25 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

Function buildCanvas has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

var buildCanvas=function(host, artefact, metricname,time){
    var name = host +"-"+ artefact;  
    var element="";
    for(var chart in charts){  
         if($(jqEscape(name+"_chart_"+charts[chart])).length==0){ 
Severity: Minor
Found in sentilo-catalog-web/src/main/webapp/static/js/sentilo/metrics.js - About 25 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

Function retrieveChartPanel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

var retrieveChartPanel = function() {
    
    var url = createChartUrl(lastObsUrl);
    var placeholder = "#plot";
    var valuePlaceholder = '#sensorLastObsValue';
Severity: Minor
Found in sentilo-catalog-web/src/main/webapp/static/js/sentilo/sensor_data.js - About 25 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

Function getData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

var getData = function() {
    
    for (var c in chartNames){ 
    var newTime=addTimeValue(chartNames[c]);
    if(newTime != window.chartNames[c].data.labels[window.chartNames[c].data.labels.length -1]){
Severity: Minor
Found in sentilo-catalog-web/src/main/webapp/static/js/sentilo/metrics.js - About 25 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

Function MarkerClusterer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function MarkerClusterer(map, opt_markers, opt_options) {
  // MarkerClusterer implements google.maps.OverlayView interface. We use the
  // extend function to extend MarkerClusterer with google.maps.OverlayView
  // because it might not always be available when the code is defined so we
  // look for it at the last possible moment. If it doesn't exist now then
Severity: Minor
Found in sentilo-catalog-web/src/main/webapp/static/js/markerclusterer.js - About 25 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

Function retrieveActivity has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

var retrieveActivity = function(placeholder, url, label) {
    if (selectedSensor.dataType === 'LINK' || 
        selectedSensor.dataType === 'AUDIO_LINK' || 
        selectedSensor.dataType === 'IMAGE_LINK' || 
        selectedSensor.dataType === 'VIDEO_LINK' || 

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

Function showLastObservations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function showLastObservations(componentId, sensorId, panel) {

    var sensor = sensorsLastObsMap[sensorId];

    if (!sensor || sensor === null || sensor === undefined) {
Severity: Minor
Found in sentilo-catalog-web/src/main/webapp/static/js/sentilo/universal_map.js - About 25 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

Severity
Category
Status
Source
Language