diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ce4c2ecc0..4e6eb11a5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -79,7 +79,7 @@ jobs: uses: actions/cache@v2 with: path: bin - key: ${{ runner.os }}-bin-shfmt@v3.4.0c-hadolint@v2.7.0 + key: ${{ runner.os }}-bin-shfmt@v3.4.0c-hadolint@v2.7.0-typos@v1.3.3 - name: Add ./bin/ to $PATH run: mkdir -p bin/ && echo "${PWD}/bin" >> $GITHUB_PATH @@ -106,3 +106,16 @@ jobs: - name: Check Dockerfile syntax run: find . -name 'Dockerfile*' -print0 | xargs -0 -n1 ./bin/hadolint --failure-threshold warning + + - name: Install typos + if: steps.shell-cache.outputs.cache-hit != 'true' + run: | + cd bin ; + wget -q 'https://github.com/crate-ci/typos/releases/download/v1.3.3/typos-v1.3.3-x86_64-unknown-linux-musl.tar.gz' && + tar -xvf *.tar.gz './typos' && + chmod +x typos && + rm *.tar.gz ; + cd .. + + - name: Check spelling + run: bin/typos diff --git a/.typos.toml b/.typos.toml new file mode 100644 index 000000000..602d08fda --- /dev/null +++ b/.typos.toml @@ -0,0 +1,39 @@ +[default.extend-identifiers] +ba9 = "ba9" +Ths2 = "Ths2" + +[files] +extend-exclude = [ + "*.fr.md", + "*.map", + "*.min.js", + "*.po", + "*.pot", + "*.rtl.css", + "app/i18n/cz/", + "app/i18n/de/", + "app/i18n/es/", + "app/i18n/fr/", + "app/i18n/he/", + "app/i18n/it/", + "app/i18n/ja/", + "app/i18n/ko/", + "app/i18n/nl/", + "app/i18n/oc/", + "app/i18n/pl/", + "app/i18n/pt-br/", + "app/i18n/ru/", + "app/i18n/sk/", + "app/i18n/tr/", + "app/i18n/zh-cn/", + "bin/", + "data/", + "docs/fr/", + "lib/lib_phpQuery.php", + "lib/PHPMailer", + "lib/SimplePie/", + "node_modules/", + "p/scripts/vendor/", + "package-lock.json", + "vendor/", +] diff --git a/Makefile b/Makefile index adf30cad1..c68cda3e7 100644 --- a/Makefile +++ b/Makefile @@ -82,6 +82,15 @@ bin/phpcbf: wget -O bin/phpcbf https://github.com/squizlabs/PHP_CodeSniffer/releases/download/3.5.5/phpcbf.phar echo '6f64fe00dee53fa7b256f63656dc0154f5964666fc7e535fac86d0078e7dea41 bin/phpcbf' | sha256sum -c - || rm bin/phpcbf +bin/typos: + mkdir -p bin/ + cd bin ; \ + wget -q 'https://github.com/crate-ci/typos/releases/download/v1.3.3/typos-v1.3.3-x86_64-unknown-linux-musl.tar.gz' && \ + tar -xvf *.tar.gz './typos' && \ + chmod +x typos && \ + rm *.tar.gz ; \ + cd .. + ########## ## I18N ## ########## @@ -192,9 +201,13 @@ npm-test: npm-fix: npm run fix +.PHONY: typos-test +typos-test: bin/typos + bin/typos + # TODO: Add shellcheck, shfmt, hadolint .PHONY: test-all -test-all: composer-test npm-test +test-all: composer-test npm-test typos-test .PHONY: fix-all fix-all: composer-fix npm-fix diff --git a/app/Controllers/statsController.php b/app/Controllers/statsController.php index 2815af4a5..d03c4fa3d 100644 --- a/app/Controllers/statsController.php +++ b/app/Controllers/statsController.php @@ -23,25 +23,25 @@ class FreshRSS_stats_Controller extends FreshRSS_ActionController { FreshRSS_View::prependTitle(_t('admin.stats.title') . ' · '); } - private function convertToSerie($data) { - $serie = array(); + private function convertToSeries($data) { + $series = array(); foreach ($data as $key => $value) { - $serie[] = array($key, $value); + $series[] = array($key, $value); } - return $serie; + return $series; } - private function convertToPieSerie($data) { - $serie = array(); + private function convertToPieSeries($data) { + $series = array(); foreach ($data as $value) { $value['data'] = array(array(0, (int) $value['data'])); - $serie[] = $value; + $series[] = $value; } - return $serie; + return $series; } /** diff --git a/app/Models/Share.php b/app/Models/Share.php index 36e17c201..c453fbaac 100644 --- a/app/Models/Share.php +++ b/app/Models/Share.php @@ -121,7 +121,7 @@ class FreshRSS_Share { /** * Update a FreshRSS_Share object with information from an array. - * @param array $options is a list of informations to update where keys should be + * @param array $options is a list of information to update where keys should be * in this list: name, url, id, title, link. */ public function update($options) { diff --git a/lib/Minz/ActionController.php b/lib/Minz/ActionController.php index cf41a4819..1d29d4c20 100644 --- a/lib/Minz/ActionController.php +++ b/lib/Minz/ActionController.php @@ -5,7 +5,7 @@ */ /** - * La classe ActionController représente le contrôleur de l'application + * The Minz_ActionController class is a controller in the MVC paradigm */ class Minz_ActionController { protected $view; @@ -16,9 +16,6 @@ class Minz_ActionController { // Gives the possibility to override the default View type. public static $viewType = 'Minz_View'; - /** - * Constructeur - */ public function __construct () { if (class_exists(self::$viewType)) { $this->view = new self::$viewType(); diff --git a/lib/Minz/Error.php b/lib/Minz/Error.php index fc8e0f807..3162c6f99 100644 --- a/lib/Minz/Error.php +++ b/lib/Minz/Error.php @@ -5,7 +5,7 @@ */ /** - * La classe Error permet de lancer des erreurs HTTP + * The Minz_Error class logs and raises framework errors */ class Minz_Error { public function __construct () { } @@ -48,10 +48,9 @@ class Minz_Error { } /** - * Permet de retourner les logs de façon à n'avoir que - * ceux que l'on veut réellement - * @param array|string $logs les logs rangés par catégories (error, warning, notice) - * @return array liste des logs, sans catégorie, en fonction de l'environment + * Returns filtered logs + * @param array|string $logs logs sorted by category (error, warning, notice) + * @return array list of matching logs, without the category, according to environment preferences (production / development) */ private static function processLogs ($logs) { $conf = Minz_Configuration::get('system'); diff --git a/lib/Minz/FrontController.php b/lib/Minz/FrontController.php index 9be39a0d1..17bbc1818 100644 --- a/lib/Minz/FrontController.php +++ b/lib/Minz/FrontController.php @@ -19,8 +19,9 @@ # ***** END LICENSE BLOCK ***** /** - * La classe FrontController est le Dispatcher du framework, elle lance l'application - * Elle est appelée en général dans le fichier index.php à la racine du serveur + * The Minz_FrontController class is the framework Dispatcher. + * It runs the application. + * It is generally invoqued by an index.php file at the root. */ class Minz_FrontController { protected $dispatcher; @@ -50,8 +51,8 @@ class Minz_FrontController { } /** - * Retourne un tableau représentant l'url passée par la barre d'adresses - * @return array représentant l'url + * Returns an array representing the URL as passed in the address bar + * @return array URL representation */ private function buildUrl() { $url = array(); diff --git a/lib/Minz/Helper.php b/lib/Minz/Helper.php index 5fddbf91c..b38292fbe 100644 --- a/lib/Minz/Helper.php +++ b/lib/Minz/Helper.php @@ -5,7 +5,7 @@ */ /** - * La classe Helper représente une aide pour des tâches récurrentes + * The Minz_Helper class contains some misc. help functions */ class Minz_Helper { diff --git a/lib/Minz/Log.php b/lib/Minz/Log.php index e0e22e532..80b93a097 100644 --- a/lib/Minz/Log.php +++ b/lib/Minz/Log.php @@ -5,7 +5,7 @@ */ /** - * La classe Log permet de logger des erreurs + * The Minz_Log class is used to log errors and warnings */ class Minz_Log { /** @@ -107,20 +107,6 @@ class Minz_Log { } } - /** - * Automatise le log des variables globales $_GET et $_POST - * Fait appel à la fonction record(...) - * Ne fonctionne qu'en environnement "development" - * @param string $file_name fichier de log - */ - public static function recordRequest($file_name = null) { - $msg_get = str_replace("\n", '', '$_GET content : ' . print_r($_GET, true)); - $msg_post = str_replace("\n", '', '$_POST content : ' . print_r($_POST, true)); - - self::record($msg_get, LOG_DEBUG, $file_name); - self::record($msg_post, LOG_DEBUG, $file_name); - } - /** * Some helpers to Minz_Log::record() method * Parameters are the same of those of the record() method. diff --git a/lib/Minz/Model.php b/lib/Minz/Model.php index 1310888cf..bf6da1599 100644 --- a/lib/Minz/Model.php +++ b/lib/Minz/Model.php @@ -5,7 +5,7 @@ */ /** - * La classe Model représente un modèle de l'application (représentation MVC) + * The Minz_Model class represents a model in the MVC paradigm. */ class Minz_Model { diff --git a/lib/Minz/ModelArray.php b/lib/Minz/ModelArray.php index 814292082..72de35f35 100644 --- a/lib/Minz/ModelArray.php +++ b/lib/Minz/ModelArray.php @@ -5,7 +5,7 @@ */ /** - * La classe Model_array représente le modèle interragissant avec les fichiers de type texte gérant des tableaux php + * The Minz_ModelArray class is the model to interact with text files containing a PHP array */ class Minz_ModelArray { /** diff --git a/lib/Minz/Paginator.php b/lib/Minz/Paginator.php index f7bb0cc4f..0d9f2b6c3 100644 --- a/lib/Minz/Paginator.php +++ b/lib/Minz/Paginator.php @@ -5,7 +5,7 @@ */ /** - * La classe Paginator permet de gérer la pagination de l'application facilement + * The Minz_Paginator is used to handle paging */ class Minz_Paginator { /** diff --git a/lib/Minz/Session.php b/lib/Minz/Session.php index d5a002005..d735f7949 100644 --- a/lib/Minz/Session.php +++ b/lib/Minz/Session.php @@ -1,7 +1,7 @@ > $url l'url à formater définie comme un tableau : + * Display a formatted URL + * @param string|array> $url The URL to format, defined as an array: * $url['c'] = controller * $url['a'] = action - * $url['params'] = tableau des paramètres supplémentaires - * ou comme une chaîne de caractère - * @param string $encodage pour indiquer comment encoder les & (& ou & pour html) + * $url['params'] = array of additional parameters + * or as a string + * @param string $encoding how to encode & (& ou & pour html) * @param bool|string $absolute - * @return string url formatée + * @return string Formatted URL */ - public static function display ($url = array (), $encodage = 'html', $absolute = false) { + public static function display ($url = array (), $encoding = 'html', $absolute = false) { $isArray = is_array($url); if ($isArray) { @@ -44,8 +44,8 @@ class Minz_Url { } if ($isArray) { - $url_string .= '/' . self::printUri($url, $encodage); - } elseif ($encodage === 'html') { + $url_string .= '/' . self::printUri($url, $encoding); + } elseif ($encoding === 'html') { $url_string = Minz_Helper::htmlspecialchars_utf8($url_string . $url); } else { $url_string .= $url; diff --git a/lib/Minz/View.php b/lib/Minz/View.php index 6b90b3c31..431a8b700 100644 --- a/lib/Minz/View.php +++ b/lib/Minz/View.php @@ -5,7 +5,7 @@ */ /** - * La classe View représente la vue de l'application + * The Minz_View represents a view in the MVC paradigm */ class Minz_View { const VIEWS_PATH_NAME = '/views'; diff --git a/lib/lib_opml.php b/lib/lib_opml.php index 3dd415d05..5c111641b 100644 --- a/lib/lib_opml.php +++ b/lib/lib_opml.php @@ -131,17 +131,17 @@ function preprocessing_categories($doc) { foreach ($outlines as $outline) { $category = trim($outline->getAttribute('category')); if ($category != '') { - $outline_categorie = null; + $outline_category = null; if (!isset($outline_categories[$category])) { - $outline_categorie = $doc->createElement('outline'); - $outline_categorie->setAttribute('text', $category); - $body->insertBefore($outline_categorie, $body->firstChild); - $outline_categories[$category] = $outline_categorie; + $outline_category = $doc->createElement('outline'); + $outline_category->setAttribute('text', $category); + $body->insertBefore($outline_category, $body->firstChild); + $outline_categories[$category] = $outline_category; } else { - $outline_categorie = $outline_categories[$category]; + $outline_category = $outline_categories[$category]; } $outline->parentNode->removeChild($outline); - $outline_categorie->appendChild($outline); + $outline_category->appendChild($outline); } } } diff --git a/lib/lib_rss.php b/lib/lib_rss.php index cc375f9ed..bc4b06497 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -160,7 +160,7 @@ function escapeToUnicodeAlternative($text, $extended = true) { function format_number($n, $precision = 0) { // number_format does not seem to be Unicode-compatible - return str_replace(' ', ' ', //Espace fine insécable + return str_replace(' ', ' ', // Thin non-breaking space number_format($n, $precision, '.', ' ') ); } diff --git a/p/scripts/global_view.js b/p/scripts/global_view.js index 366729485..2b57ecf9e 100644 --- a/p/scripts/global_view.js +++ b/p/scripts/global_view.js @@ -34,9 +34,9 @@ function load_panel(link) { document.getElementById('overlay').classList.add('visible'); panel.classList.add('visible'); - // force le démarrage du scroll en haut. - // Sans ça, si l’on scroll en lisant une catégorie par exemple, - // en en ouvrant une autre ensuite, on se retrouve au même point de scroll + // Force the initial scroll to the top. + // Without it, if one scrolls down in a category (for instance) + // and then open another one, we risk being at the same scroll position panel.scrollTop = 0; document.documentElement.scrollTop = 0; diff --git a/p/themes/Ansum/_components.scss b/p/themes/Ansum/_components.scss index f6ab4acb6..b89821df3 100644 --- a/p/themes/Ansum/_components.scss +++ b/p/themes/Ansum/_components.scss @@ -101,7 +101,7 @@ } .tree .tree-folder .tree-folder-items .dropdown-menu { - // tout ça sert à restaurer l’apparence du dropdown dans un contexte de sidebar sombre + // to reset the appearance of the dropdown in the case of a dark sidebar .item { padding: 0; diff --git a/p/themes/Ansum/_variables.scss b/p/themes/Ansum/_variables.scss index 981d64e99..e899bec13 100644 --- a/p/themes/Ansum/_variables.scss +++ b/p/themes/Ansum/_variables.scss @@ -45,7 +45,7 @@ $fav-light: #fff6da; // la couleur de sidebar, utile si on a envie d’un thème qui aurait une sidebar foncé, e.g. $sid-font-color: #363330; // la couleur de fond de la barre de gauche et du header $sid-bg: #fbf9f6; // le background général de la barre de gauche, et du header -$sid-bg-alt: #f7f2ea; // le background de l’intérieur des groupes +$sid-bg-alt: #f7f2ea; // background inside groups $sid-bg-dark: #efe3d3; // les hovers $sid-sep: #f0e7da; // les séparateurs $sid-active: $main-first; // la couleur active diff --git a/p/themes/Dark/metadata.json b/p/themes/Dark/metadata.json index bdc068c2e..7a85bd6cf 100644 --- a/p/themes/Dark/metadata.json +++ b/p/themes/Dark/metadata.json @@ -1,7 +1,7 @@ { "name": "Dark", "author": "AD", - "description": "Le coté obscur du thème “Origine”", + "description": "The dark side of the “Origine” theme", "version": 0.2, "files": ["_template.css", "dark.css"] } diff --git a/p/themes/Mapco/_components.scss b/p/themes/Mapco/_components.scss index a0d1d30ca..840da5258 100644 --- a/p/themes/Mapco/_components.scss +++ b/p/themes/Mapco/_components.scss @@ -100,7 +100,7 @@ } .tree .tree-folder .tree-folder-items .dropdown-menu { - // tout ça sert à restaurer l’apparence du dropdown dans un contexte de sidebar sombre + // to reset the appearance of the dropdown in the case of a dark sidebar .item { padding: 0; diff --git a/p/themes/Mapco/_variables.scss b/p/themes/Mapco/_variables.scss index f8d7f8d77..a932cd83a 100644 --- a/p/themes/Mapco/_variables.scss +++ b/p/themes/Mapco/_variables.scss @@ -45,7 +45,7 @@ $fav-light: #fff6da; // la couleur de sidebar, utile si on a envie d’un thème qui aurait une sidebar foncé, e.g. $sid-font-color: #fff; // la couleur de fond de la barre de gauche et du header $sid-bg: #303136; // le background général de la barre de gauche, et du header -$sid-bg-alt: #26272a; // le background de l’intérieur des groupes +$sid-bg-alt: #26272a; // background inside groups $sid-bg-dark: #17181a; // les hovers $sid-sep: #3f3f3f; // les séparateurs $sid-active: $main-first; // la couleur active