Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GScan 2.0 - next try 🤠 #151

Merged
merged 28 commits into from
Aug 14, 2018
Merged

GScan 2.0 - next try 🤠 #151

merged 28 commits into from
Aug 14, 2018

Conversation

kirrg001
Copy link
Contributor

@kirrg001 kirrg001 commented Aug 14, 2018

We have worked on GScan for two weeks.
We are about to release GScan 2.0.

refs TryGhost/Ghost#9742

aileen and others added 28 commits August 14, 2018 22:04
closes #116

- CLI
    - Added `-1, --v1` option to allow cli usage of GScan to check for 1.0 theme compatibility
    - Passed `options` that includes a `checkVersion` property, which is set to `v1` when cli called with `-1`, or `latest` by default.
- Restructure current specs
    - created a new `/specs` directory
    - renamed current `spec.js` to `v1.js`
    - duplicated current `spec.js` to `latest.js` -> will contain only differences later
    - the latest version will inherit the ruleset from `v1`, but overwrite properties that exist in both
- App
    - Offered a select box with the - currently - two accepted versions, whereas the latest is set to default
    - Passed the selected version to gscan
- Checks
    - moveed checks properties (regex, helpername, cssclass) to the rules in spec
    - useed list of rules to specify which rules have to run for each version (concat them, if applicable)
    - require the version of the spec that we need for the checks only
refs #116

- Added a util with a version file, that can take properties and handle `latest` versions and other versions in a more gneric way
- Added functionality that replaces old document links with the new ones, based on the `latest` version number.
refs #116

- uses the versions util to fetch the major version and pass it along our `theme` object
- outputs the tested version for CLI and App usage
- for module usage, GScan returns a `checkedVersion` property with the major version that it was checked for
- updated README to include version usage
refs #122

- `gscan.format` now accepts a new option to return a different format
  - sort by errors & warnings files (sortByFiles: true)
  - sort by rules by default
- it's currently hard to sort the passed rules, because no rule is pushed with the file reference
  - too much effort for no usage
no issue

- failures[..].ref is always the target file reference
- ensure consistency
refs #115

- Added deprecation for `.kg-card-markdown` CSS class in latest ruleset
- Restructured the test fixtures for deprecation tests to test `v1` and `latest`
- Added tests added  CSS class deprecation
closes #115

- Added a new checking file that checks the presence of two CSS classes:
    1. `.kg-width-wide`
    2. `.kg-width-full`
- A missing CSS file, or one of the classes missing will cause the theme to be invalid
- The errors are classed as fatal
- Some more consistency for test wordings
closes #119

- Added svg partials for arrow up and down (taken from ghost.org)
- Added toggle on click, but does not really work with native `select` -> could try chosen at some point
- Updated CSS file processed and stored in ghost.org
closes #99

- Includes preparation work from @CriticalRespawn 👏🏼
- Refactored the rules to be used by the `latest` version only
- Added `include=author` check and fixed tests
- Added `{{#author}}` deprecation
    - Added property `notValidIn` that takes a template file to exclude checks in there. This applies for example when `{{#author}}` is called in `author.hbs, where it's in author context and therefore the correct usage.
- Added `{{author}}` helper deprecations
- Added `{{author.*}}` checks
- Added `{{post.author.*}}` checks
- Added `../author` check in all possible variations
- Added `fields="author"` checks
- Added `filter="author:[...]"` checks
- Added `{{img_url author.*}}` checks
- Added `{{#if author.*}}` checks
- Added `{{#if post.author.*}}` checks
- Updated old `author` checks for 2.0
- Added missing v1 checks for `{{#if post.author.image|cover}}`
- Modified new v1 rules for 2.0
no issue

- Changed the recommendendation for the `{{#author}}` block helper to `{{#primary_author}}` instead of `{{#authors}}`
no issue

- CSS classes that are required should not prevent Ghost from booting
- The two new Koenig CSS classes should therefore not be classed as fatal errors
- Update docs to link to new ghost-editor page on themes.ghost.org
no issue

- Updated the README to explain the different levels of errors and warnings
- Explain the importance of GScan in relation with upgrades
closes #137

- Added deprecation check to detect `{{error.statusCode}}` as well as `{{statusCode}}`
closes #129

- Added a check that detects the usage of `{{@blog.permalinks}}`, and creates a non-fatal error
- The recommendation is to remove the usage in the theme
- When running tests with different versions, we were seeing the tests fail as if they were being run with the wrong version, but only when all tests were run
- Lodash's merge/extend/defaults methods overwrite the first object passed to them
- Always use merge/extend/defaults with an empty or static object first, unless you really mean to change the value of the first object
- This is a major gotcha!
closes #143

- Add a check for `ghost-theme` in the keywords list
- Provides us a way to detect from a package.json if a package is intended to be a valid Ghost theme
- Also gives us a way to find Ghost themes via npm/GitHub
- We'll start making use of this sooooooon when it catches on
- Will be an error in Ghost 3.0
closes #140

- Instead of listing all rules per checker again, we read them with a regex from the spec
- 030 assets check is currently the only check with the two rules hard coded
no issue

- formatting issue
no issue

- this rule was the only rule which said "Please read the details."
- there are always details
no issue

- {{img_url}} does nothing by itself
refs #99

- the rules haven't really worked
- i had to add much more rules to output the correct rules and messages

e.g. your theme uses this expression in any theme

> {{author.image}}

And GScan was showing

> Replace the <code>{{primary_author.image}}</code> helper with <code>{{primary_author.profile_image}}</code>

- this is caused by using generic rules, which does not work
- i had to define exact rules for all cases
closes #105

- Show exit code 1 if there are any errors or warnings
- We show this for warnings because warnings are still things that should be fixed e.g. will be errors in the next version
- The purpose of exit codes is for CI, so that themes can validate they are getting as good a score as possible
- Therefore it makes sense to get a failure for warnings
- Also output a quick summary
no issue

- say that this theme attribute was removed, not deprecated
@ErisDS ErisDS deleted the 2.0-new branch April 6, 2020 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants