Skip to content

SonarLint discussion #1

@Roustalski

Description

@Roustalski

Hi,

I have your extension pack installed but have run across an issue with SonarLint. There isn't currently a way to disable a particular rule, even though I find the code analysis very helpful.

As an example:

// Typescript snippet

import { IHookProperties, setDefault } from "ts-log-class";

setDefault({
  hook: (logProps: IHookProperties) => {
    if (logProps.arguments.hasOwnProperty("user")) {
      const user: any = JSON.parse(logProps.arguments.user);
      // @SupressWarnings("all")
      user.password = "[secret]";
      logProps.arguments.user = JSON.stringify(user);
    }
    return JSON.stringify(logProps);
  },
  out: (message?: any, ...optionalParameters: any[]) => {
    Logging.Logger.debug(message, optionalParameters);
  }
});

In this case I need to suppress the error Credentials should not be hard-coded (typescript:S2068) because one, it is a copy of the object, and two it prevents the password from being printed/logged in my cloud provider. Since there is no way to currently suppress this and any other errors that are false positives, should we consider temporarily removing SonarLint from the pack?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions