Skip to content

Commit

Permalink
[CI] Add a job to check for duplicate files
Browse files Browse the repository at this point in the history
Those would yield ambiguity when doing "From Stdlib Require File.".
There are already a few in the prelude, let's not add more.
  • Loading branch information
proux01 committed Oct 3, 2024
1 parent b07f3f4 commit 0342674
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/basic-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ jobs:
uses: actions/checkout@v4
- name: Check consistency of files in Makefiles
run: dev/tools/check-make-sync.sh
- name: Check for duplicate files
run: dev/tools/check-duplicate-files.sh
72 changes: 72 additions & 0 deletions dev/tools/check-duplicate-files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/sh

# List of all files in the coq repo
FILES_PRELUDE="\
ArrayAxioms.v \
Basics.v \
BinNums.v \
CMorphisms.v \
CRelationClasses.v \
CarryType.v \
Datatypes.v \
Decimal.v \
Equivalence.v \
FloatAxioms.v \
FloatClass.v \
FloatOps.v \
Hexadecimal.v \
Init.v \
IntDef.v \
ListDef.v \
Logic.v \
Ltac.v \
Morphisms.v \
Morphisms_Prop.v \
Nat.v \
NatDef.v \
Notations.v \
Number.v \
Peano.v \
PosDef.v \
Prelude.v \
PrimArray.v \
PrimFloat.v \
PrimInt63.v \
PrimString.v \
PrimStringAxioms.v \
RelationClasses.v \
Relation_Definitions.v \
Setoid.v \
SetoidTactics.v \
Sint63Axioms.v \
SpecFloat.v \
Specif.v \
Sumbool.v \
Tactics.v \
Uint63Axioms.v \
Utils.v \
Wf.v \
ssrbool.v \
ssrclasses.v \
ssreflect.v \
ssrfun.v \
ssrmatching.v \
ssrsetoid.v \
ssrunder.v"

ALL_FILES=all_files__
ALL_FILES_UNIQ=all_files_uniq__

rm -f ${ALL_FILES} ${ALL_FILES_UNIQ}
(for f in ${FILES_PRELUDE} $(find theories -name "*.v") ; do basename $f ; done) | sort > ${ALL_FILES}
uniq ${ALL_FILES} > ${ALL_FILES_UNIQ}

if $(diff -q ${ALL_FILES_UNIQ} ${ALL_FILES} > /dev/null) ; then
echo "No files with duplicate name"
else
echo "Some files with the same name"
diff ${ALL_FILES_UNIQ} ${ALL_FILES}
exit 1
fi

rm -f ${ALL_FILES} ${ALL_FILES_UNIQ}

0 comments on commit 0342674

Please sign in to comment.