---
title: "Spotless: no false spotlessCheck failure in Java | VulCode"
description: "A fix in Spotless, the Gradle formatting plugin, in Java: spotlessCheck no longer fails with \"0 lint error(s)\" when stale copies remain in spotless-clean."
url: "https://vulcode.com/en/opensource/contributions/spotless"
lang: "en"
---

[All contributions](https://vulcode.com/en/opensource/contributions)

diffplug/spotless

# Spotless

A Gradle and Maven plugin that formats code in many languages, from Java and Kotlin to SQL and YAML, and enforces that formatting in the build.

[See the repository](https://github.com/diffplug/spotless) [All contributions](https://vulcode.com/en/opensource/contributions)

- **Language**: Java
- **GitHub stars**: 5,736
- **Merged changes**: 1

## What we changed

spotlessCheck no longer fails with "There were 0 lint error(s)" when the spotless-clean directory only holds stale copies of files that already match what is on disk. The lint exception is thrown only when there are actual lints.

### What this work shows

- Gradle tasks and plugins

- Code formatting in the build

- JUnit tests for a Gradle plugin

What was broken

### The check failed on zero errors

The issue described that after gradle clean openApiGenerate spotlessApply a directory stays behind in build/spotless-clean, and the next spotlessCheck or build throws There were 0 lint error(s). getUncleanFiles skipped files that matched the disk, but SpotlessCheck still went into the lint branch and threw with an empty list.

How we fixed it

### An exception only for real lints

The lint branch now runs only when the list of lints is not empty. Otherwise the task finishes without an error, since the files in spotless-clean are stale copies of what is already on disk. A new test, checkPassesWhenCleanFileMatchesDisk, covers this case, and the change has an entry in CHANGES.md.

[#3189](https://github.com/diffplug/spotless/pull/3189)

## Merged change 1

- [#3189 Fix `spotlessCheck` failing with 0 lint errors on stale clean files Merged 20 November 2026](https://github.com/diffplug/spotless/pull/3189)

## What it taught us

From a message about zero errors we traced the branch the code fell into when there were neither unformatted files nor lints. We close such a state with a test that recreates it in the plugin's working directory.

[More about this technology: Java](https://vulcode.com/en/technologies/java)

## Other projects we write code for

- [**Paper** Java · 12,832 stars A performance-focused Minecraft server that fixes gameplay and mechanics inconsistencies. It keeps its changes to the game code as patches on the Minecraft sources.](https://vulcode.com/en/opensource/contributions/paper)

- [**Node.js** JavaScript · 123,955 stars The JavaScript runtime built on V8 that runs servers, command line tools and front-end build pipelines. It ships a built-in node:sqlite module for working with SQLite databases.](https://vulcode.com/en/opensource/contributions/nodejs)

- [**Godot Engine** C++ · 120,623 stars An open source, multi-platform 2D and 3D game engine with its own editor, where game developers build scenes and interfaces.](https://vulcode.com/en/opensource/contributions/godot)

- [**Material UI** JavaScript · 99,391 stars A React component library that implements Google's Material Design: ready-made text fields, selects, buttons and other interface elements.](https://vulcode.com/en/opensource/contributions/material-ui)

- [**Zed** Rust · 95,562 stars A fast code editor in Rust from the creators of Atom and Tree-sitter, with live multiplayer editing.](https://vulcode.com/en/opensource/contributions/zed)

- [**uv** Rust · 92,647 stars An extremely fast Python package and project manager written in Rust. It creates projects, installs dependencies and manages virtual environments.](https://vulcode.com/en/opensource/contributions/uv)

## Describe your project.

A free quote comes back within an hour during working hours.

### Rather skip the form?

Ask in the chat or write to us directly.

Open the chat

- **Email**: [hello@vulcode.com](mailto:hello@vulcode.com)
- **Phone**: [+48 576 043 920](tel:+48576043920)
- **Discord**: [discord.gg/vulcode](https://discord.gg/vulcode)
