71 Commits

Author SHA1 Message Date
MDW
63a78d8c00 Qual: Add perltidy & perlcritic + updates to fix notices. (#36370)
* Qual: Add pre-commit hooks for Perl code formatting and linting

- Added perltidy hook to format Perl code
- Added perlcritic hook to lint Perl code

* Qual: Update file opening syntax in build scripts (perltidy)

The changes update the syntax for opening files in several build scripts to use the three-argument form of the `open` function, which is more secure and recommended in modern Perl practices.

* Qual: Improve file handling and add strict/warnings pragmas (perlcritic)

The changes include:
- Adding 'use strict' and 'use warnings' pragmas to enforce better coding practices
- Improving file handling by using lexical filehandles (my $IN, my $SPECFROM, etc.)
- Fixing file opening and closing operations to use proper error handling
- Updating various file operations to use the new lexical filehandles
- Fixing indentation and formatting issues in the code

* Qual: Add strict and warnings pragmas to Perl scripts (perlcritic)

The changes add 'use strict;' and 'use warnings;' pragmas
- dev/build/doxygen/dolibarr-doxygen-build.pl
- dev/build/doxygen/dolibarr-doxygen-filter.pl
- dev/build/doxygen/dolibarr-doxygen-getversion.pl
- dev/build/gource/getavatars.pl
- dev/tools/dolibarr-mysql2pgsql.pl

* Qual: Add Perl no critic pragmas (perlcritic)

- Ignore some perlcritic notices

* Qual: Improve code formatting and readability

Perltidy:

- Indentation and spacing
- Improved variable naming and alignment
- Better code organization and structure
- Enhanced readability of conditional statements and loops

These changes do not alter the functionality of the script but make it more maintainable and easier to understand.

* qual: Exclude virtualmin from perltidy and perlcritic hooks

Exclude the virtualmin directory from both perltidy and perlcritic hooks due to specific reasons mentioned in the comment. This change ensures that these hooks do not process files in the virtualmin directory.

* Qual: Add installation of perltidy and perlcritic for pre-commit workflow

This commit adds the installation of perltidy and perlcritic as part of the pre-commit hooks workflow.

* Fix: Update version detection in dolibarr-doxygen-build.pl

- Add support for detecting version from DOL_MAJOR_VERSION and DOL_MINOR_VERSION constants
- Fix undefined variable issue in version detection

* Fix: Update getavatars.pl to use HTTPS and reverse git log

- Changed the URL from HTTP to HTTPS for Gravatar
- Added `--reverse` flag to git log command to process commits in chronological order (faster)
- Updated error message to indicate .git repository instead of .git directory (+ correct test)

* fix: Correct spelling in error messages and prompts

- Fixed typo in error message for missing environment variables
- Corrected spelling in prompt for module name input
- Improved clarity in comment for target checking
2025-11-23 01:52:07 +01:00
MDW
1072419141 Qual: Update pre-commit hooks (#36262)
* Qual: Update pre-commit hooks

# Qual: Update pre-commit hook

Updated several pre-commit hooks as long as the new ones are not alpha or beta versions

* Qual: Fix/ignore some shellcheck issues
2025-11-17 21:50:29 +01:00
Frédéric FRANCE
e274a9c31c do not check in htdocs/includes (#35886)
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2025-10-22 02:47:05 +02:00
MDW
acd82fcc4b Update tool versions in .pre-commit-config (#33494)
* Update tool versions in .pre-commit-config

# Update tool versions in .pre-commit-config

Update tool versions for pre-commit.
codespell is updated in #33493 .
Prettier was upgraded to 3.1.0 - higher versions are
not compatible with the normal pre-commit workflow apparently.

* Ignore notice from sqlfluff

Ignore LT14 - The 'WHERE' keyword should always start a new line.
2025-03-19 14:51:07 +01:00
MDW
c9804cf6be Qual: Update codespell to 2.4.1 + fix spelling (#33493)
# Qual: Update codespell to 2.4.1 + fix spelling

Update codespell version in pre-commit configuration,
fix new codespell notices
2025-03-19 14:50:44 +01:00
Laurent Destailleur (aka Eldy)
49f5eabc22 Merge branch '21.0' of git@github.com:Dolibarr/dolibarr.git into develop 2025-01-05 18:44:56 +01:00
Laurent Destailleur (aka Eldy)
1d194efc3d Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into 21.0 2025-01-05 18:43:15 +01:00
Laurent Destailleur (aka Eldy)
0d4631247b Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into 20.0 2025-01-05 18:40:56 +01:00
Laurent Destailleur (aka Eldy)
757d1b2998 Merge branch '18.0' of git@github.com:Dolibarr/dolibarr.git into 19.0 2025-01-05 18:40:05 +01:00
Laurent Destailleur (aka Eldy)
8805b8cac4 Exclude test files 2025-01-05 17:22:30 +01:00
Laurent Destailleur (aka Eldy)
9a61a6e6c9 Update files after moving build into dev/ 2025-01-05 14:46:26 +01:00
Laurent Destailleur (aka Eldy)
6a492eaf4e Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into develop 2025-01-05 12:31:33 +01:00
Frédéric France
027e05eef3 fix 2025-01-04 16:19:40 +01:00
Frédéric France
f5c32492b2 exclude directory 2025-01-04 15:42:01 +01:00
Frédéric FRANCE
d784f3e22b Update .pre-commit-config.yaml 2025-01-04 09:30:26 +01:00
Frédéric FRANCE
62bd14a68d fix ci branch 20.0 2024-12-19 18:54:51 +01:00
Frédéric France
dbcc198061 fix CI 2024-12-19 18:51:40 +01:00
Frédéric France
3cedf2ee54 fix CI 2024-12-19 18:47:07 +01:00
Laurent Destailleur (aka Eldy)
6be3801b57 Merge 2024-12-19 18:02:37 +01:00
Laurent Destailleur (aka Eldy)
15bea06204 Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into 20.0 2024-12-19 17:57:54 +01:00
Laurent Destailleur (aka Eldy)
7185da6504 Merge branch '18.0' of git@github.com:Dolibarr/dolibarr.git into 19.0 2024-12-19 17:54:37 +01:00
tnegre
b73bcd68a9 pre-commit : change regex for hook no-commit-to-branch in order to allow branches BEGINNING by 18.0, such as 18.0_fix_foo 2024-12-18 10:47:46 +01:00
Laurent Destailleur (aka Eldy)
a810b9be45 Fix precommit 2024-11-27 19:19:25 +01:00
Laurent Destailleur (aka Eldy)
23ca75c27f Try to fix phan 2024-11-27 19:03:12 +01:00
Frédéric FRANCE
8c0c033e49 add phpdoc in mailing modules (#31786)
* add phpdoc

* add phpdoc

* add phpdoc

* add phpdoc

* add phpdoc

* add phpdoc

* add phpdoc

* add phpdoc

* test

* test

* test

* test
2024-11-13 15:27:26 +01:00
Benoît PASCAL
ff9e2f3ce9 NEW: add duration extrafields (#31595)
* new: add duration extrafields

* style: fix style

* ci: fix precommit config

* style: run cs fixer

* ci: adapt type to fit with php-stan

* ci: adapt type to fit with php-stan

* ci: adapt type to fit with php-stan

---------

Co-authored-by: Benoît PASCAL <contact@p-ben.com>
2024-10-28 18:33:11 +01:00
MDW
622c718429 Qual: Add actions-lint to pre-commit (#31252)
# Qual: Add actions-lint to pre-commit

This finds issues with actions.
Fixed exakat.
2024-10-03 19:34:26 +02:00
MDW
ec07381f2c Qual: More specific ignoreErrors for phpstan (#31113)
* Qual: More specific ignoreErrors for phpstan

# Qual: More specific ignoreErrors for phpstan

More specific ignore expressions helps identify new exceptions that
would have matched the more generic ignore expressions.

It also helps to progressively solve phpstan notices
in smaller steps by modifying the expressions

* CamelCase for dictFieldList

* Update phan baseline
2024-09-26 17:42:40 +02:00
Frédéric FRANCE
0e816c32ac Update .pre-commit-config.yaml (#30875) 2024-09-06 13:22:20 +02:00
Laurent Destailleur
e9212f127c NEW Add gitleaks into pre-commit 2024-09-05 12:03:03 +02:00
Laurent Destailleur
c80d75c8b3 NEW Add gitleaks into pre-commit 2024-09-05 11:57:32 +02:00
Laurent Destailleur
78b344d779 NEW Add gitleaks into pre-commit 2024-09-05 11:53:24 +02:00
MDW
d6948077b2 Qual: Fix spelling/update .pre-commit configuration (versions) (#30546)
* Qual: Update pre-commit configuration

* Qual: Update spelling

* Ignore use of deprecated constant
2024-08-07 01:20:43 +02:00
Laurent Destailleur
87065f0395 Update doc 2024-07-21 01:12:18 +02:00
Laurent Destailleur
f29fbd277f Update doc 2024-07-21 01:08:45 +02:00
Laurent Destailleur
143edfa294 Update doc 2024-07-21 01:08:09 +02:00
Laurent Destailleur
1d3a7a353e Update doc 2024-07-21 01:07:40 +02:00
Laurent Destailleur
e1175158c3 Fix exclude 2024-07-21 00:12:30 +02:00
Laurent Destailleur
c5e10bc354 Fix error sqlfuff on large mysqldump. 2024-07-20 19:08:48 +02:00
Laurent Destailleur
236230585d Debug v20 2024-05-31 13:30:05 +02:00
MDW
fad3e2d2bf QUAL: Add sqlfluff (SQL code and style check) (#29097)
* QUAL: Add sqlfluff (SQL code and style check)

# QUAL: Add sqlfluff (SQL code and style check)

This adds a validity and style check on the .sql files.
The same tool can be used to fix style (which can be set up as a
pre-commit hook).

* Ignore some sqlfluff notices

* Ignore RF04 notice, warning about the use of sql keywords

* Adjust dialects for some directories
2024-04-16 01:23:27 +02:00
MDW
c23794a23c NEW: Script for fast identification of missing/unused/duplicate translations
# NEW: Script for fast identification of missing/unused/duplicate translations

Fast analysis of files to identify missing, unused and duplicate translations.
Fast = less than 3 seconds when there are no exceptions (on my development machine).
2024-03-10 16:39:42 +01:00
MDW
20b740dcc8 Qual: Review pre-commit configure - re-enable no-commit-to-branch (#28385)
# Qual: Review pre-commit configure - re-enable no-commit-to-branch

This reviews some of the documentation inside the pre-commit-config.yaml file.
It also re-enables the no-commit-to-branch hook.

Also enable spelling on hidden files (changes to pyproject.toml +
exceptions file).
2024-02-24 15:38:20 +01:00
MDW
cb382eabe1 Fix: PhanParamSignatureMismatch (#28143)
* Fix: PhanParamSignatureMismatch

# Fix: PhanParamSignatureMismatch

PhanDoc was updated to require specific types which changes the method signature
versus the parent.
This results in a signature mismatch.
Updated to maintain the method signature but dynamically check that
the object type is correct.

* Update pre-commit for php-cs
2024-02-18 23:46:30 +01:00
Laurent Destailleur
42243d141a Test pre-commit 2024-02-18 14:28:24 +01:00
Laurent Destailleur
a59fa7eca0 Test 2024-02-18 14:27:15 +01:00
Laurent Destailleur
fb54306a1e Update precommit 2024-02-18 13:39:25 +01:00
MDW
60f15baef2 Qual: Backport: pre-commit php-cs with cache (#28123)
* Qual: Lower severity on php-cs messages that should not block (#28072)

# Qual: Lower severity on php-cs messages that should not block

Some warning messages result in php-cs having an exit code of 2 and others
only have an exit ocde of 1.  When the exit code is 2, the warnings are fixable
by php-cbf.

In order to be able to filter on the warnings in the github ci flow, but still
show them in the travis flow, I lower the level of the warnings that should not
be blocking to 4.

At the same time, the php-cs configuration in pre-commit now requires that the
severity is minimum 5 to show the message (level 5 is the default for all warnings
and errors).

So this will limit the warning messages to the ones that should result in a failing
ci action.  If any new cases are discovered, they should also be lowered in the
php-cs configuration file.

* Qual: ci: Run pre-commit/php-cs with cache (#28079)

This adds a hook to .pre-commit-config.yaml and updates the workflow
to run php-cs with cache when it is run for all files.
When running on changed files only, the cache is not useful.

The php-codesniffer ruleset.xml was cleaned up (duplicates removal/formatted)
2024-02-12 03:30:19 +01:00
MDW
16f723f0ba Qual Language scripts fixed/updated (#28101)
* Qual: Fix/extend language scripts, integrate in pre-commit

Updated scripts to comply with shellscript.
Integrated one in pre-commit that seems useful.

* Qual: Find duplicate lang keys

* Add line numbers (to allow annotation)

* Fix fixaltlanguages.sh and add to pre-commit

* Make historical language checks 'manual' in 'pre-commit'
2024-02-10 17:26:34 +01:00
MDW
7a389299c3 Qual: ci: Run pre-commit/php-cs with cache (#28079)
This adds a hook to .pre-commit-config.yaml and updates the workflow
to run php-cs with cache when it is run for all files.
When running on changed files only, the cache is not useful.

The php-codesniffer ruleset.xml was cleaned up (duplicates removal/formatted)
2024-02-10 01:22:07 +01:00