Manual:Pre-commit checklist/fr

Ceci est une tentative de création d'une liste de choses à vérifier avant de valider des modifications. Certains de ces points font doublon avec ce qu'il y a dans conventions de codage, mais sont sous la forme de vérifications rapides. Cette checklist est dans le même genre que The Checklist Manifesto. Certaines de ces choses semble évidentes (comme si l'on demandait à un médecin "avez-vous lavé vos mains ?"), mais sont là afin d'éviter des problèmes qui pourraient être oubliés.

Dorsal (PHP)

 * Did your code run without errors under ?
 * Votre code a-t-il échoué à un des tests unitaires ? Voir.
 * Avez-vous testé tous les points de sorties de votre code ?
 * Avez-vous pour l'indentation utilisé des tabulations au lieu d'espaces ?
 * Did you remove extraneous, commented-out debug code? (e.g.  and/or  )
 * If you've created a new function, did you document the function parameters and what it returns using Doxygen?
 * Have you created any identifiers that didn't use camelCase (ie. underscores)?
 * Is every exception tested?
 * If you have multiple return points, are they tested?
 * Does each message you've created exist in, have message documentation in  ?
 * Is each use of,  , etc. checked for errors or problems?
 * Did you use  or   flags for   to ensure Windows compatibility?
 * Have you used the proper output functions?   should almost never be used.
 * Have you used the proper termination functions?   should almost never be used.
 * Where appropriate, have you used the MediaWiki wrapper functions instead of their PHP equivalents?
 * instead of  to get boolean params.
 * For database access, see Manual:Database_access.
 * If you added a new test to, did you give it a new name?
 * If you added a new hook, did you document it?

Test
When adding features, it's vital to verify you didn't break existing functionality. We have three kinds of tests you can be required to write for backend code:


 * Parser tests: Test the parser output for wikitext (see ). Try running   to see how those work.  Everything should pass, in theory.  You can add new tests or fix existing ones by editing.
 * Unit tests (PHPUnit): Located in the  directory. They are typically run through the   script invoked from the aforementioned directory. These tests also include ordinary parser tests, though   probably works faster. Read Manual:PHP unit testing for more information about how to setup PHPUnit and further details on how it is used inside MediaWiki.
 * Selenium: tests are in directory.

Anyway, if you can't write an automatic test, do manual testing. If you cause breakage too often, people will get annoyed at you.

Frontal

 * Tested in an actual browser? The smallest changes could break things that aren't obvious. Kick that browser open, navigate around, perhaps make an edit, log-in, add a page to your watchlist.
 * Did your code break any of the unit tests? See Manual:JavaScript unit testing
 * Will it work at least in the browsers we support for A-grade functionality (check Compatibility)?
 * Are there any implied globals other than  or  ? There should not be, (not   either)

Test automatique
Jenkins runs some tests on most repositories when changes are submitted to gerrit and approved. You should run these tests locally before committing a patch. Many extensions implement the standard Continuous integration/Entry points and so you can run npm test and grunt test before committing.

Realistically, you won't always manually test every change. It depends on how big failure can be and whether there are good unit tests for the change.


 * Does it validate (or did you at least run it through) JSHint or JSLint ? (check recommended settings)
 * Unit tests (QUnit): Located in the  directory. They are typically run from the browser via . Read Manual:JavaScript unit testing for more information on how to enable it, how it works and the various options that are available.