jabrythehutt/awsrd

View on GitHub

Showing 9 of 11 total issues

Function constructor has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  constructor(scope: Construct, id: string, props: VscInstanceProps) {
    super(scope, id);
    this.instance = new Instance(this, "Instance", props);
    this.topic = new Topic(this, "InactivityTopic", {
      displayName: `Inactivity topic for ${this.instance.instanceId}`,
Severity: Major
Found in VscInstance.ts - About 2 hrs to fix

    Function run has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    async function run() {
      const args = await yargs(hideBin(process.argv))
        .option(SsmProxyScriptArg.InstanceId, { type: "string", demand: true })
        .option(SsmProxyScriptArg.Port, { type: "number", demand: true })
        .option(SsmProxyScriptArg.PublicKeyPath, { type: "string", demand: true })
    Severity: Major
    Found in ssmProxyScript.ts - About 2 hrs to fix

      Function execute has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        async execute(instanceId: string): Promise<void> {
          const instance = await this.instanceStore.describe(instanceId);
          const label = toInstanceLabel(instance as Instance);
          await commands.executeCommand(CommandName.start, instanceId);
          await window.withProgress(
      Severity: Minor
      Found in OpenCommandProvider.ts - About 2 hrs to fix

        Function resolve has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          async resolve(
            request: Record<StackArg | ContextArg, string | undefined>,
            construct: Construct
          ): Promise<VscInstanceProps> {
            const image = request.imageId
        Severity: Minor
        Found in InstancePropsResolver.ts - About 1 hr to fix

          Function execute has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async execute(instanceId: string): Promise<void> {
              const instance = await this.instanceStore.describe(instanceId);
              const label = toInstanceLabel(instance as Instance);
              const title = `${
                this.targetState === "running" ? "Starting" : "Stopping"
          Severity: Minor
          Found in InstanceStateCommandProvider.ts - About 1 hr to fix

            Function start has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              async start(request: {
                instanceId: string;
                port: number;
                profile: string;
              }): Promise<ChildProcess> {
            Severity: Minor
            Found in SessionStarter.ts - About 1 hr to fix

              Function constructor has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                constructor(clientFactory: AwsClientFactory) {
                  this.ec2Client = clientFactory.createAwsClient(EC2Client);
                  this.instances = combineLatest([this.ec2Client, this.refreshSubject]).pipe(
                    switchMap(([client]) => this.listAll(client)),
                    shareReplay(1)
              Severity: Minor
              Found in InstanceStore.ts - About 1 hr to fix

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

                    if (region !== undefined) {
                      await workspace
                        .getConfiguration()
                        .update(configPath, region, ConfigurationTarget.Global);
                      await commands.executeCommand(CommandName.refresh);
                Severity: Minor
                Found in RegionCommandProvider.ts and 1 other location - About 35 mins to fix
                ProfileCommandProvider.ts on lines 18..23

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

                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

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

                    if (profile) {
                      await workspace
                        .getConfiguration()
                        .update(configPath, profile, ConfigurationTarget.Global);
                      await commands.executeCommand(CommandName.refresh);
                Severity: Minor
                Found in ProfileCommandProvider.ts and 1 other location - About 35 mins to fix
                RegionCommandProvider.ts on lines 17..22

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

                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

                Severity
                Category
                Status
                Source
                Language