Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • T ticket
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,809
    • Issues 1,809
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Administrator
  • ticket
  • Issues
  • #78

Closed
Open
Created Jan 04, 2022 by Administrator@rootMaintainer

Unnecessary imports should be removed

Created by: armorcodegithubqa[bot]

The imports part of a file should be handled by the Integrated Development Environment (IDE), not manually by the developer.

Unused and useless imports should not occur if that is the case.

Leaving them in reduces the code's readability, since their presence can be confusing.

Noncompliant Code Example

package my.company;import java.lang.String;        // Noncompliant; java.lang classes are always implicitly importedimport my.company.SomeClass;    // Noncompliant; same-package files are always implicitly importedimport java.io.File;            // Noncompliant; File is not usedimport my.company2.SomeType;import my.company2.SomeType;    // Noncompliant; 'SomeType' is already importedclass ExampleClass {  public String someString;  public SomeType something;}

Exceptions

Imports for types mentioned in comments, such as Javadocs, are ignored.

File Path: webgoat-server/src/main/java/org/owasp/webgoat/HSQLDBDatabaseConfig.java:18

Mitigation: Remove this unused import 'java.util.Map'.

https://qa.armorcode.ai/#/findings/5440220

Assignee
Assign to
Time tracking