aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2022-01-09 18:21:40 +0100
committerGravatar GitHub <noreply@github.com> 2022-01-09 18:21:40 +0100
commit4e2dff4591bb2062311c1d5bfcdca3ade2a76d16 (patch)
treea876374a709f04f919b35ae8e1e53774a0aca39c
parent9dbbe924c5e54b5dbe486873a9b31a28127c8e62 (diff)
Add spell checking with typos (#4138)
* Add spell checking with typos Implement https://github.com/FreshRSS/FreshRSS/pull/4134#issuecomment-1008027558 * GitHub Actions attempt * Quiet wget * Makefile
-rw-r--r--.github/workflows/tests.yml15
-rw-r--r--.typos.toml39
-rw-r--r--Makefile15
-rw-r--r--app/Controllers/statsController.php16
-rw-r--r--app/Models/Share.php2
-rw-r--r--lib/Minz/ActionController.php5
-rw-r--r--lib/Minz/Error.php9
-rw-r--r--lib/Minz/FrontController.php9
-rw-r--r--lib/Minz/Helper.php2
-rw-r--r--lib/Minz/Log.php16
-rw-r--r--lib/Minz/Model.php2
-rw-r--r--lib/Minz/ModelArray.php2
-rw-r--r--lib/Minz/Paginator.php2
-rw-r--r--lib/Minz/Session.php2
-rw-r--r--lib/Minz/Url.php20
-rw-r--r--lib/Minz/View.php2
-rw-r--r--lib/lib_opml.php14
-rw-r--r--lib/lib_rss.php2
-rw-r--r--p/scripts/global_view.js6
-rw-r--r--p/themes/Ansum/_components.scss2
-rw-r--r--p/themes/Ansum/_variables.scss2
-rw-r--r--p/themes/Dark/metadata.json2
-rw-r--r--p/themes/Mapco/_components.scss2
-rw-r--r--p/themes/Mapco/_variables.scss2
24 files changed, 119 insertions, 71 deletions
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<string,string> $options is a list of informations to update where keys should be
+ * @param array<string,string> $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,string>|string $logs les logs rangés par catégories (error, warning, notice)
- * @return array<string> liste des logs, sans catégorie, en fonction de l'environment
+ * Returns filtered logs
+ * @param array<string,string>|string $logs logs sorted by category (error, warning, notice)
+ * @return array<string> 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 {
/**
@@ -108,20 +108,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 @@
<?php
/**
- * La classe Session gère la session utilisateur
+ * The Minz_Session class handles user’s session
*/
class Minz_Session {
private static $volatile = false;
diff --git a/lib/Minz/Url.php b/lib/Minz/Url.php
index 0bbf28b0d..06390c4c6 100644
--- a/lib/Minz/Url.php
+++ b/lib/Minz/Url.php
@@ -1,21 +1,21 @@
<?php
/**
- * La classe Url permet de gérer les URL à travers MINZ
+ * The Minz_Url class handles URLs across the MINZ framework
*/
class Minz_Url {
/**
- * Affiche une Url formatée
- * @param string|array<string,string|array<string,mixed>> $url l'url à formater définie comme un tableau :
+ * Display a formatted URL
+ * @param string|array<string,string|array<string,mixed>> $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 &amp; pour html)
+ * $url['params'] = array of additional parameters
+ * or as a string
+ * @param string $encoding how to encode & (& ou &amp; 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