Skip to content

Commit

Permalink
Merge branch 'master' of github.com:wikimedia-gadgets/afc-helper
Browse files Browse the repository at this point in the history
  • Loading branch information
ptsgrn committed Jun 25, 2024
2 parents 7f3e478 + d4d8ef6 commit a0141f4
Show file tree
Hide file tree
Showing 24 changed files with 8,672 additions and 676 deletions.
65 changes: 21 additions & 44 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,54 +1,31 @@
{
"extends": "wikimedia",
"plugins": [
"jsdoc"
],
"env": {
"browser": true,
"jquery": true
},
"globals": {
"AFCH": true,
"Hogan": false,
"importScript": false,
"mediaWiki": true,
"mw": true,
"OO": false
"AFCH": "writable",
"Hogan": "readonly",
"importScript": "readonly",
"mediaWiki": "writable",
"mw": "writable",
"OO": "readonly"
},
"rules": {
"camelcase": 0,
"eqeqeq": 0,
"jsdoc/check-param-names": 0,
"jsdoc/check-tag-names": 0,
"jsdoc/no-undefined-types": 0,
"jsdoc/require-param-type": 0,
"jsdoc/require-returns": 0,
"jsdoc/require-returns-check": 0,
"jsdoc/valid-types": 0,
"max-len": 0,
"max-statements-per-line": 0,
"no-console": 0,
"no-global-assign": 0,
"no-implicit-globals": 0,
"no-new": 0,
"no-prototype-builtins": 0,
"no-shadow": 0,
"no-undef": 0,
"no-underscore-dangle": 0,
"no-unused-vars": 0,
"no-use-before-define": 0,
"no-useless-concat": 0,
"no-useless-escape": 0,
"one-var": 0,
"spaced-comment": 0,
"vars-on-top": 0
},
"settings": {
"jsdoc": {
"ignoreInternal": true
}
},
"ignorePatterns": [
"scripts/generate-certificates.js"
]
"camelcase": "off",
"eqeqeq": "warn",
"max-len": "off",
"no-console": "off",
"no-global-assign": "warn",
"no-implicit-globals": "warn",
"no-new": "warn",
"no-prototype-builtins": "off",
"no-shadow": "off",
"no-undef": "warn",
"no-underscore-dangle": "off",
"security/detect-non-literal-regexp": "off",
"security/detect-unsafe-regex": "off",
"unicorn/prefer-string-slice": "off"
}
}
12 changes: 12 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Linter

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm install
- run: npm run lint
name: AFCH linter
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@ build
*/*.*~
*/#*.*#
*.swp
package-lock.json
certificates/
pywikibot-*
throttle.ctrl
user-*
venv/
logs/
apicache-py3/
8 changes: 4 additions & 4 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ module.exports = function ( grunt ) {
},

eslint: {
target: [ 'src/**/*.js', 'contrib/**/*.js', '__tests__/**/*.js', 'Gruntfile.js' ]
target: [ 'src/**/*.js', 'contrib/**/*.js', 'tests/**/*.js', 'Gruntfile.js' ]
},

exec: {
Expand All @@ -81,15 +81,15 @@ module.exports = function ( grunt ) {
grunt.loadNpmTasks( 'grunt-exec' );

grunt.registerTask(
'teststyle',
'lint',
'Tests files for code style and code quality.',
[ 'eslint' ]
);

grunt.registerTask(
'test',
'Runs unit tests as well as checks code style/quality.',
[ 'teststyle', 'exec:jest' ]
[ 'exec:jest' ]
);

grunt.registerTask(
Expand All @@ -101,7 +101,7 @@ module.exports = function ( grunt ) {
grunt.registerTask(
'build',
'Tests files, moves them to the /build directory, and minifies CSS.',
[ 'clean:build', 'test', 'copy', 'concat:dependencies', 'styling' ]
[ 'clean:build', 'test', 'lint', 'copy', 'concat:dependencies', 'styling' ]
);

grunt.registerTask( 'default', [ 'build' ] );
Expand Down
43 changes: 18 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,43 @@
afch-rewrite [![Unit Tests](https://github.com/ptsgrn/afch-rewrite/actions/workflows/unit_tests.yml/badge.svg?branch=master)](https://github.com/ptsgrn/afch-rewrite/actions/workflows/unit_tests.yml) ![Release](https://img.shields.io/github/v/release/ptsgrn/afch-rewrite)
afc-helper [![Build Status](https://github.com/ptsgrn/afch-rewrite/actions/workflows/unit_tests.yml/badge.svg)]
============

**v0.9.3 Imperial Kane**

A tool for reviewing Articles for Creation submissions on the English Wikipedia, rewritten using clear, object-oriented JavaScript with a focus on killing bloat while adding value.

### Using
The script can be installed on the English Wikipedia by following the instructions at [WP:AFCH](https://en.wikipedia.org/wiki/WP:AFCH).

### Contributing
*Looking for detailed instructions about how to contribute to afch-rewrite? Check out the [Contributing](https://en.wikipedia.org/wiki/Wikipedia:WikiProject_Articles_for_creation/Helper_script/Contributing) page on Wikipedia!*
*Looking for detailed instructions about how to contribute to afc-helper? Check out the [Contributing](https://en.wikipedia.org/wiki/Wikipedia:WikiProject_Articles_for_creation/Helper_script/Contributing) page on Wikipedia!*

Your contributions are welcome! Please add feature requests and bug reports to [WT:AFCH](https://en.wikipedia.org/wiki/WT:AFCH) on enwiki to keep discussions centralized; GitHub also works.

If you'd like to contribute directly to the code, that's great too! In order to maintain great code quality, please submit significant changes using pull requests so that a consistent code style can be maintained throughout the project.

To serve the script locally for development, use `npm start` and follow the instructions. The [Contributing](https://en.wikipedia.org/wiki/Wikipedia:WikiProject_Articles_for_creation/Helper_script/Contributing) page has more details if you get stuck.

**Protip for developers**: if you set `AFCH.consts.mockItUp = false;` using your browser console or in src/afch.js, instead of logging API requests in the console, the script will actually make page edits. (It used to default to making the page edits, but that wasn't very useful.)
**Protip for developers**: AFCH running using `npm start` will run in silent mode by default. That is, it will not edit any pages, but instead will output API queries to your browser console. To turn this off, add `window.afchSuppressDevEdits = false;` to your common.js file, or open a browser console and type `AFCH.consts.mockItUp = false;`

### Testing
We have unit tests! `afch-rewrite` uses [Jest](https://github.com/facebook/jest) for testing, a framework built on top of Jasmine that offers dead-simple mocking, built-in simulated DOM manipulation using [jsdom](https://github.com/tmpvar/jsdom), and more.
We have unit tests! `afc-helper` uses [Jest](https://github.com/facebook/jest) for testing, a framework built on top of Jasmine that offers dead-simple mocking, built-in simulated DOM manipulation using [jsdom](https://github.com/tmpvar/jsdom), and more.

Tests are stored in the `__tests__` directory and are run automatically on new commits via GitHub Actions.
Tests are stored in the `tests` directory and are run automatically on new commits via GitHub Actions.

### Uploading and releasing the script
To upload the script to a wiki, use `scripts/upload.py`. Detailed instructions are included at the top of the file.
### Deploying
Interface administrators can [click here](https://en.wikipedia.org/wiki/Wikipedia:WikiProject_Articles_for_creation/Helper_script/Deploying) for a detailed work instruction of how to deploy to English Wikipedia.

New versions of the script can be released through `scripts/release.py`, which automatically updates version history, inline version constants, `package.json`, etc.
To deploy AFC Helper to a wiki, use `scripts/upload.py`.

### Version history
### Dependencies
Below is a list of dependencies and what they are involved with, so you know what to test when updating dependencies.

* 0.9.3 Imperial Kane (13 Octuber 2022)
* 0.9.3-beta Imperial Kane (21 November 2021)
* 0.9.3-alpha Imperial Kane (13 November 2021)
* 0.9.1 Imperial Ibex (05 December 2018)
* 0.9 Hatted Hamster (8 November 2014)
* 0.8 Wandering Walrus (18 May 2014)
* 0.7 Less is More (13 April 2014)
* 0.6 Dancing Turtle (27 March 2014)
* 0.5 Cold Moose (21 March 2014)
* 0.4 Rewired Robot (14 March 2014)
* 0.3 Excited Murmur (12 March 2014)
* 0.2 Egalitarian Elephant (27 February 2014)
* 0.1 Exploding Fireball (4 January 2014)
* Regular
* hogan.js - HTML template framework. Creates code that ends up on-wiki.
* Dev Only
* eslint - Used by CI and code editor
* grunt - Used by CI and `npm start`
* jest-cli - Used by CI and unit tests
* jquery - Used by CI and unit tests

### License

`afch-rewrite` is licensed under the GNU General Public License version 3; see LICENSE for more information.
`afc-helper` is licensed under the GNU General Public License version 3; see LICENSE for more information.
2 changes: 1 addition & 1 deletion STYLEGUIDE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Style guide
===========

For the most part, we follow [MediaWiki coding conventions](https://www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript). Code should validate with JSHint (see configuration in `.jshintrc`) as well as JSCS (see configuration in `.jscsrc`). GitHub Actions is used to ensure consistent code style/quality; tests are run on all commits and pull requests.
For the most part, we follow [MediaWiki coding conventions](https://www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript). Code should validate with ESLint (see configuration in `.eslintrc.json`). GitHub Actions is used to ensure consistent code style/quality; unit tests and linting are run on all commits and pull requests.

## Tips
* _**TABS!**_
Expand Down
20 changes: 0 additions & 20 deletions __tests__/test-core.js

This file was deleted.

15 changes: 0 additions & 15 deletions contrib/loader.js

This file was deleted.

86 changes: 0 additions & 86 deletions contrib/old-afch-whitelist-checker.js

This file was deleted.

Loading

0 comments on commit a0141f4

Please sign in to comment.