Skip to content

feat(Linter): suggested capitalisation according to the naming convention - #45783

Draft
joneugster wants to merge 6 commits into
leanprover-community:masterfrom
joneugster:feat/decap-names-linter
Draft

joneugster wants to merge 6 commits into
leanprover-community:masterfrom
joneugster:feat/decap-names-linter

Conversation

@joneugster

@joneugster joneugster commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

This environment linter checks that all parts of theorem (and lemma) names are capitalised correctly, following the mathlib naming convention.

It aims to be the source of truth for the capitalisation rule of the naming convention, so the manually written rules there can be simplified.

The linter can be called locally by running lake lint.

This has been worked out after it has been pointed out that the naming convention leaves room for interpretation whether the lower-cased version of e.g. NNReal should be nnReal or nnreal.


Zulip: a draft of this has been worked out in #mathlib reviewers > Lowercasing the initial sequence of caps

@joneugster joneugster added WIP Work in progress t-linter Linter labels Nov 7, 2026
@github-actions github-actions Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Nov 7, 2026
@joneugster
joneugster force-pushed the feat/decap-names-linter branch from af12116 to 93d89a2 Compare November 7, 2026 20:27
@github-actions github-actions Bot added large-import Automatically added label for PRs with a significant increase in transitive imports and removed merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) labels Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

PR summary 236d27e69d

Import changes exceeding 2%

% File
+2.06% Mathlib.Init

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.Tactic 3110 3117 +7 (+0.23%)
Import changes for all files
Files Import difference
../mathlib-ci/scripts/pr_summary/import_trans_difference.sh all
There are 8649 files with changed transitive imports taking up over 378082 characters: this is too many to display!
You can run this locally from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci


Declarations diff (regex)

+ Lean.Name.lastComponentAsString
+ Lean.Name.recommendedSpellings
+ Lean.Name.suggestTheoremName
+ List.getSingleton?
+ _root_.String.lowerStart
+ suggestedNameLinter

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean -- pending)

Computed after the build finishes.


No changes to strong technical debt.
No changes to weak technical debt.

Current commit 236d27e69d
Reference commit 59c7f902e2

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.py pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@joneugster
joneugster force-pushed the feat/decap-names-linter branch from 0fb85c5 to 236d27e Compare November 8, 2026 00:20
@grunweg

grunweg commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Initial adaptations for this linter have been/are being made in #45536, #45735 and #45788.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

large-import Automatically added label for PRs with a significant increase in transitive imports t-linter Linter WIP Work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants