pmd / pmd/pmd

[java] UnnecessaryImport: optionally ignore unused on-demand imports

Open
#2,877 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

an:enhancement
Dominant language
Java
Stars
5.5k
Forks
1.6k
Avg merge
1d 19h
Merged PRs (30d)
54

Description

Rule: UnnecessaryImport (previously known as UnusedImport)

I like to use the UnusedImport rule to prevent developers from forget to delete imports not used anymore. However, I had to ignore this rule in my projects because I don't want to add every single import for a bunch of dependencies that a class have, I mean the use of the start * symbol. Would be nice if the UnusedImports rule could be configured to decide when I want to consider the star symbol or not.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the UnnecessaryImport rule documentation and its implementation, focusing on how rule configuration distinguishes unused imports from on-demand imports. Check the existing rule tests and configuration entry points. Done means users can configure whether imports using the * symbol are considered by the rule, with tests covering both settings.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.