瀏覽代碼

Add spelling check; fix spelling errors (#360)

Vince Salvino 4 年之前
父節點
當前提交
b60430d223

+ 6 - 3
azure-pipelines.yml

@@ -76,8 +76,8 @@ stages:
   dependsOn: Unit_Tests
   condition: succeeded('Unit_Tests')
   jobs:
-  - job: flake8
-    displayName: flake8
+  - job: linters
+    displayName: Linters
     pool:
       vmImage: 'ubuntu-latest'
 
@@ -91,11 +91,14 @@ stages:
     - script: python -m pip install -r requirements-ci.txt
       displayName: 'CR-QC: Install coderedcms from local repo'
 
+    - pwsh: ./ci/spellcheck.ps1
+      displayName: 'CR-QC: Spelling'
+
     - script: coderedcms start testproject
       displayName: 'CR-QC: Generate a test project'
 
     - pwsh: ./ci/run-flake8.ps1
-      displayName: 'CR-QC: Static analysis (flake8)'
+      displayName: 'CR-QC: Flake8'
 
   - job: codecov
     displayName: Code Coverage

+ 34 - 0
ci/spellcheck.ps1

@@ -0,0 +1,34 @@
+#!/usr/bin/env pwsh
+
+<#
+.SYNOPSIS
+Checks spelling of code and docs.
+#>
+
+# Get path.
+$scriptDir = Split-Path $PSCommandPath -Parent
+$projectDir = (Get-Item $scriptDir).Parent
+
+# Set working directory to root of project.
+Push-Location $projectDir
+
+$ExitCode = 0
+
+# Run spell checker.
+codespell --skip="migrations,vendor,_build,*.css.map,*.jpg,*.png,*.pyc" `
+    coderedcms docs
+$ExitCode = $LastExitCode
+
+# Print output.
+if ($ExitCode -eq 0) {
+    Write-Host "Spelling looks good!"
+}
+else {
+    # Write the error in a way that shows up as the failure reason in Azure Pipelines.
+    Write-Host -ForegroundColor Red `
+        "##vso[task.LogIssue type=error;]Spelling errors! 👩‍🏫"
+}
+
+# Unset working directory and exit with pytest's code.
+Pop-Location
+exit $ExitCode

+ 1 - 1
coderedcms/blocks/base_blocks.py

@@ -1,5 +1,5 @@
 """
-Bases, mixins, and utilites for blocks.
+Bases, mixins, and utilities for blocks.
 """
 
 from django import forms

+ 1 - 1
coderedcms/blocks/content_blocks.py

@@ -211,7 +211,7 @@ class PriceListItemBlock(BaseBlock):
         label=_('Image'),
     )
     name = blocks.CharBlock(
-        requred=True,
+        required=True,
         max_length=255,
         label=_('Name'),
     )

+ 1 - 1
coderedcms/blocks/html_blocks.py

@@ -98,7 +98,7 @@ class EmbedGoogleMapBlock(BaseBlock):
 
 class EmbedVideoBlock(BaseBlock):
     """
-    Emedded media using stock wagtail functionality.
+    Embedded media using stock wagtail functionality.
     """
     url = EmbedBlock(
         required=True,

+ 20 - 20
coderedcms/forms.py

@@ -17,30 +17,30 @@ from coderedcms.settings import cr_settings
 from coderedcms.utils import attempt_protected_media_value_conversion
 
 FORM_FIELD_CHOICES = (
-    (_('Text'), (
-        ('singleline', _('Single line text')),
-        ('multiline', _('Multi-line text')),
-        ('email', _('Email')),
-        ('number', _('Number - only allows integers')),
-        ('url', _('URL')),
+    (_("Text"), (
+        ("singleline", _("Single line text")),
+        ("multiline", _("Multi-line text")),
+        ("email", _("Email")),
+        ("number", _("Number - only allows integers")),
+        ("url", _("URL")),
     ),),
-    (_('Choice'), (
-        ('checkboxes', _('Checkboxes')),
-        ('dropdown', _('Drop down')),
-        ('radio', _('Radio buttons')),
-        ('multiselect', _('Multiple select')),
-        ('checkbox', _('Single checkbox')),
+    (_("Choice"), (
+        ("checkboxes", _("Checkboxes")),
+        ("dropdown", _("Drop down")),
+        ("radio", _("Radio buttons")),
+        ("multiselect", _("Multiple select")),
+        ("checkbox", _("Single checkbox")),
     ),),
-    (_('Date & Time'), (
-        ('date', _('Date')),
-        ('time', _('Time')),
-        ('datetime', _('Date and time')),
+    (_("Date & Time"), (
+        ("date", _("Date")),
+        ("time", _("Time")),
+        ("datetime", _("Date and time")),
     ),),
-    (_('File Upload'), (
-        ('file', _('Secure File - login required to access uploaded files')),
+    (_("File Upload"), (
+        ("file", _("Secure File - login required to access uploaded files")),
     ),),
-    (_('Other'), (
-        ('hidden', _('Hidden field')),
+    (_("Other"), (
+        ("hidden", _("Hidden field")),
     ),),
 )
 

File diff suppressed because it is too large
+ 29 - 0
coderedcms/migrations/0019_spelling_corrections.py


+ 3 - 3
coderedcms/models/page_models.py

@@ -292,7 +292,7 @@ class CoderedPage(WagtailCacheMixin, Page, metaclass=CoderedPageMeta):
         blank=True,
         max_length=255,
         verbose_name=_('Country'),
-        help_text=_('For example, USA. Two-letter ISO 3166-1 alpha-2 country code is also acceptible https://en.wikipedia.org/wiki/ISO_3166-1'),  # noqa
+        help_text=_('For example, USA. Two-letter ISO 3166-1 alpha-2 country code is also acceptable https://en.wikipedia.org/wiki/ISO_3166-1'),  # noqa
     )
     struct_org_geo_lat = models.DecimalField(
         blank=True,
@@ -465,7 +465,7 @@ class CoderedPage(WagtailCacheMixin, Page, metaclass=CoderedPageMeta):
 
     def __init__(self, *args, **kwargs):
         """
-        Inject custom choices and defalts into the form fields
+        Inject custom choices and defaults into the form fields
         to enable customization by subclasses.
         """
         super().__init__(*args, **kwargs)
@@ -482,7 +482,7 @@ class CoderedPage(WagtailCacheMixin, Page, metaclass=CoderedPageMeta):
     @cached_classmethod
     def get_edit_handler(cls):
         """
-        Override to "lazy load" the panels overriden by subclasses.
+        Override to "lazy load" the panels overridden by subclasses.
         """
         panels = [
             ObjectList(

+ 1 - 1
coderedcms/project_template/basic/project_name/settings/base.py

@@ -78,7 +78,7 @@ MIDDLEWARE = [
     'django.middleware.clickjacking.XFrameOptionsMiddleware',
     'django.middleware.security.SecurityMiddleware',
 
-    #  Error reporting. Uncomment this to recieve emails when a 404 is triggered.
+    #  Error reporting. Uncomment this to receive emails when a 404 is triggered.
     # 'django.middleware.common.BrokenLinkEmailsMiddleware',
 
     # CMS functionality

+ 0 - 2
coderedcms/project_template/basic/project_name/settings/prod.py

@@ -36,8 +36,6 @@ SERVER_EMAIL = DEFAULT_FROM_EMAIL
 #         'NAME': '{{ project_name }}',
 #         'USER': '{{ project_name }}',
 #         'PASSWORD': '',
-#         # If using SSL to connect to a cloud mysql database, spedify the CA as so.
-#         'OPTIONS': { 'ssl': { 'ca': '/path/to/certificate-authority.pem' } },
 #     }
 # }
 

File diff suppressed because it is too large
+ 5 - 4
coderedcms/project_template/basic/website/migrations/0001_initial.py


+ 1 - 2
coderedcms/project_template/basic/website/models.py

@@ -1,5 +1,5 @@
 """
-Createable pages used in CodeRed CMS.
+Creatable pages used in CodeRed CMS.
 """
 from modelcluster.fields import ParentalKey
 from coderedcms.forms import CoderedFormField
@@ -74,7 +74,6 @@ class FormConfirmEmail(CoderedEmail):
 class WebPage(CoderedWebPage):
     """
     General use page with featureful streamfield and SEO attributes.
-    Template renders all Navbar and Footer snippets in existance.
     """
     class Meta:
         verbose_name = 'Web Page'

+ 1 - 1
coderedcms/project_template/sass/project_name/settings/base.py

@@ -77,7 +77,7 @@ MIDDLEWARE = [
     'django.middleware.clickjacking.XFrameOptionsMiddleware',
     'django.middleware.security.SecurityMiddleware',
 
-    # Error reporting. Uncomment this to recieve emails when a 404 is triggered.
+    # Error reporting. Uncomment this to receive emails when a 404 is triggered.
     #'django.middleware.common.BrokenLinkEmailsMiddleware',
 
     # CMS functionality

+ 0 - 2
coderedcms/project_template/sass/project_name/settings/prod.py

@@ -36,8 +36,6 @@ SERVER_EMAIL = DEFAULT_FROM_EMAIL
 #        'NAME': '{{ project_name }}',
 #        'USER': '{{ project_name }}',
 #        'PASSWORD': '',
-#        # If using SSL to connect to a cloud mysql database, spedify the CA as so.
-#        'OPTIONS': { 'ssl': { 'ca': '/path/to/certificate-authority.pem' } },
 #    }
 #}
 

File diff suppressed because it is too large
+ 5 - 4
coderedcms/project_template/sass/website/migrations/0001_initial.py


+ 1 - 2
coderedcms/project_template/sass/website/models.py

@@ -1,5 +1,5 @@
 """
-Createable pages used in CodeRed CMS.
+Creatable pages used in CodeRed CMS.
 """
 from modelcluster.fields import ParentalKey
 from coderedcms.forms import CoderedFormField
@@ -74,7 +74,6 @@ class FormConfirmEmail(CoderedEmail):
 class WebPage(CoderedWebPage):
     """
     General use page with featureful streamfield and SEO attributes.
-    Template renders all Navbar and Footer snippets in existance.
     """
     class Meta:
         verbose_name = 'Web Page'

+ 2 - 2
coderedcms/templates/coderedcms/includes/struct_data_article.json

@@ -10,7 +10,7 @@
   "description": "{{page.get_description}}",
 
   {# Get different aspect ratios. Use huge numbers because wagtail will not upscale, #}
-  {# but will max out at the image's original resultion using the specified aspect ratio. #}
+  {# but will max out at the image's original resolution using the specified aspect ratio. #}
   {# Google wants them high resolution. #}
   {% if page.og_image %}
     {% image page.struct_org_image fill-10000x10000 as img_11 %}
@@ -47,4 +47,4 @@
   {% endif %}
 
   "@type": "Article"
-}
+}

+ 1 - 1
coderedcms/templates/coderedcms/includes/struct_data_event.json

@@ -12,7 +12,7 @@
   {% endif %}
 
   {# Get different aspect ratios. Use huge numbers because wagtail will not upscale, #}
-  {# but will max out at the image's original resultion using the specified aspect ratio. #}
+  {# but will max out at the image's original resolution using the specified aspect ratio. #}
   {# Google wants them high resolution. #}
   {% if page.og_image %}
     {% image page.struct_org_image fill-10000x10000 as img_11 %}

+ 1 - 1
coderedcms/templates/coderedcms/includes/struct_data_org.json

@@ -19,7 +19,7 @@
 
     {% if page.struct_org_image %}
         {# Get different aspect ratios. Use huge numbers because wagtail will not upscale, #}
-        {# but will max out at the image's original resultion using the specified aspect ratio. #}
+        {# but will max out at the image's original resolution using the specified aspect ratio. #}
         {# Google wants them high resolution. #}
         {% image page.struct_org_image fill-10000x10000 as img_11 %}
         {% image page.struct_org_image fill-40000x30000 as img_21 %}

+ 1 - 1
coderedcms/tests/settings.py

@@ -79,7 +79,7 @@ MIDDLEWARE = [
     'django.middleware.clickjacking.XFrameOptionsMiddleware',
     'django.middleware.security.SecurityMiddleware',
 
-    # Error reporting. Uncomment this to recieve emails when a 404 is triggered.
+    # Error reporting. Uncomment this to receive emails when a 404 is triggered.
     # 'django.middleware.common.BrokenLinkEmailsMiddleware',
 
     # CMS functionality

+ 0 - 1
coderedcms/tests/testapp/models.py

@@ -78,7 +78,6 @@ class FormConfirmEmail(CoderedEmail):
 class WebPage(CoderedWebPage):
     """
     General use page with featureful streamfield and SEO attributes.
-    Template renders all Navbar and Footer snippets in existance.
     """
     class Meta:
         verbose_name = 'Web Page'

+ 1 - 1
coderedcms/wagtail_hooks.py

@@ -46,7 +46,7 @@ def codered_forms(user, editable_forms):
     from coderedcms.models import CoderedFormMixin
     """
     Add our own CoderedFormPage to editable_forms, since wagtail is unaware
-    of its existance. Essentailly this is a fork of wagtail.contrib.forms.get_forms_for_user()
+    of its existence. Essentially this is a fork of wagtail.contrib.forms.get_forms_for_user()
     and wagtail.contrib.forms.get_form_types()
     """
     form_models = [

+ 24 - 7
docs/features/page_types/index.rst

@@ -15,15 +15,24 @@ Page Types
 Design Philosophy
 -----------------
 
-Pages for your CodeRed CMS site use a "Parent-Child" relationship.  A parent page is any page that is an ancestor of other pages in the site's tree structure.  A child page is any page that is a descendant of another page in the site's tree structure.  A lot of specific site functionality is broken up into these "Parent-Child" relationships.  For example, if you want to add a blog to your site, you would add an "Article Landing Page", which would have your "Article Page"s as descendants.  
+Pages for your CodeRed CMS site use a "Parent-Child" relationship.  A parent
+page is any page that is an ancestor of other pages in the site's tree
+structure.  A child page is any page that is a descendant of another page in the
+site's tree structure.  A lot of specific site functionality is broken up into
+these "Parent-Child" relationships.  For example, if you want to add a blog to
+your site, you would add an "Article Landing Page", which would have your
+"Article Page"s as descendants.
 
 .. note::
-    
-    | A site's page struture could look like the following:
+
+    | A site's page structure could look like the following:
 
         Home Page -> Article Landing Page -> Article Page
-    
-    In this example, Home Page is a direct ancestor/parent of Article Landing Page.  Article Landing Page is a direct descendant/child of Home Page.  Article Landing Page is also a direct ancestor/parent of Article Page.  Article Page is a direct descendant/child of Article Landing Page.
+
+    In this example, Home Page is a direct ancestor/parent of Article Landing
+    Page.  Article Landing Page is a direct descendant/child of Home Page.
+    Article Landing Page is also a direct ancestor/parent of Article Page.
+    Article Page is a direct descendant/child of Article Landing Page.
 
 Below is a table of the current possible "Parent-Child" relationships.
 
@@ -36,9 +45,17 @@ Event Landing Page    Event Page
 Location Landing Page Location Page
 ===================== ====================================================================================
 
-To add a new child page to any existing page, navigate to that page in the admin and click on the "Add Child Page" button.
+To add a new child page to any existing page, navigate to that page in the admin
+and click on the "Add Child Page" button.
+
 
 Development Philosophy
 ----------------------
 
-When it comes to pages on the site, we strive to keep all the core functionality in Abstract models.  When you create a new CodeRed CMS project, your generated app will come pre-loaded with Concrete implementations of some of these Abstract models.  These concrete models are yours to modify as needed.  But do be advised that changing built in functionality could have untested consequences.  By keeping the core page functionality abstract, migrations are easier to deal with on a per project basis.
+When it comes to pages on the site, we strive to keep all the core functionality
+in Abstract models.  When you create a new CodeRed CMS project, your generated
+app will come pre-loaded with Concrete implementations of some of these Abstract
+models.  These concrete models are yours to modify as needed.  But do be advised
+that changing built in functionality could have untested consequences.  By
+keeping the core page functionality abstract, migrations are easier to deal with
+on a per project basis.

+ 68 - 24
docs/features/page_types/web_pages.rst

@@ -1,63 +1,107 @@
 Web Pages
-===================
+=========
+
+The standard page for your website. All other page types on the site will share
+the functionality of this page type.
 
-The standard page for your website.  All other page types on the site will share the functionality of this page type.
 
 Usage
 -----
 
-First start by creating a "Web Page".  Each page on your site will have an assortment of tabs that house different types of data/content for that page.
+First start by creating a "Web Page". Each page on your site will have an
+assortment of tabs that house different types of data/content for that page.
+
 
 Tabs
 ----
 
-In the Wagtail admin, we break up all the fields on a page into seperate tabs to help with readability and to group similar functionality together.  Listed below are the available tabs, what they do, and what fields you can expect to be shown in them.
+In the Wagtail admin, we break up all the fields on a page into separate tabs to
+help with readability and to group similar functionality together. Listed below
+are the available tabs, what they do, and what fields you can expect to be shown
+in them.
+
 
 Content Tab
 ~~~~~~~~~~~
 
-The **Content** tab is meant to house all data fields related to the page's content.  You have the following options:
+The **Content** tab is meant to house all data fields related to the page's
+content. You have the following options:
 
 * **Title**: The name of the page.
+
 * **Cover Image**: The big hero image you want for the page.
-* **Body**: The field your content will live.  This uses a StreamField to allow you to dynamically create a page layout and content.
+
+* **Body**: The field your content will live. This uses a StreamField to allow
+  you to dynamically create a page layout and content.
 
 Classify Tab
 ~~~~~~~~~~~~
 
-The **Classify** tab is meant to house all data fields related to the page's classification.  You have the following options:
+The **Classify** tab is meant to house all data fields related to the page's
+classification. You have the following options:
+
+* **Classifier Terms**: The taxonomies you want assigned to this page. These
+  taxonomies can be used for certain blocks to control what pages are related to
+  a certain block. These taxonomies are defined in the Snippets section of the
+  admin.
 
-* **Classifier Terms**: The taxonomies you want assigned to this page.  These taxonomies can be used for certain blocks to control what pages are related to a certain block.  These taxonomies are defined in the Snippets section of the admin.
-* **Tags**: An optional tagging mechanism that can be used by a developer for any reason.
+* **Tags**: An optional tagging mechanism that can be used by a developer for
+  any reason.
 
 Layout Tab
 ~~~~~~~~~~
 
-The **Layout** tab is meant to house all data fields related to the page's layout.  You have the following options:
+The **Layout** tab is meant to house all data fields related to the page's
+layout. You have the following options:
 
 * **Template**:  The template you want the page to use to render.
-* **Show List of Child Pages**: Toggles whether this parent page should show a list of its children pages.
-* **Number Per Page**: Controls how many children pages you want to show at once.
-* **Order Children Pages by**: Controls how the children pages are sorted on this parent page.
-* **Filter Child Pages by**: Using Classifier terms, control which children pages are shown on the parent page.
+
+* **Show List of Child Pages**: Toggles whether this parent page should show a
+  list of its children pages.
+
+* **Number Per Page**: Controls how many children pages you want to show at
+  once.
+
+* **Order Children Pages by**: Controls how the children pages are sorted on
+  this parent page.
+
+* **Filter Child Pages by**: Using Classifier terms, control which children
+  pages are shown on the parent page.
 
 SEO Tab
 ~~~~~~~
 
-The **SEO** tab is meant to house all data fields related to the page's SEO  settings, like Open Graph tags and Google's structured data.  You have the following options:
+The **SEO** tab is meant to house all data fields related to the page's SEO
+settings, like Open Graph tags and Google's structured data. You have the
+following options:
+
+* **Slug**: The URL path you want the page to exist on. If not set, it will be
+  automatically generated from this page's title.
+
+* **Page Title**: The title you want to be shown at the top of your web browser.
 
-* **Slug**: The url path you want the page to exist on.  If not set, it will be automatically generated from this page's title.
-* **Page Title**: The title you want to be shown at the top of your web browser
-* **Search Description**: The description you want to be placed in your site's meta tags.
-* **Open Graph preview image**:  The image you want your site to show when someone shares this page on social media.
+* **Search Description**: The description you want to be placed in your site's
+  meta tags.
 
-* **Structured Data** - Organization: These are numerous fields to construct structured data that Google uses.  Fill this out on your home page and it will apply to all pages on your site.
+* **Open Graph preview image**:  The image you want your site to show when
+  someone shares this page on social media.
+
+* **Structured Data** - Organization: These are numerous fields to construct
+  structured data that Google uses. Fill this out on your home page and it will
+  apply to all pages on your site.
 
 Settings Tab
 ~~~~~~~~~~~~
 
-The **Settings** tab is meant to house different controls for the page rendering.  You have the following options:
+The **Settings** tab is meant to house different controls for the page
+rendering. You have the following options:
+
+* **Go live date/time**: The date/time you want this page to be visible to
+  visitors.
+
+* **Expiry date/time**: The date/time you want this page to become invisible to
+  visitors.
 
-* **Go live date/time**: The date/time you want this page to be visible to visitors.
-* **Expiry date/time**: The date/time you want this page to become invisible to visitors.
-* **Content Walls**: This StreamField allows you to select Content Wall snippets that will be displayed to your users before they can access the page.  A common use case is a pop up showing them a limited offer.
+* **Content Walls**: This StreamField allows you to select Content Wall snippets
+  that will be displayed to your users before they can access the page. A common
+  use case is a pop up showing them a limited offer.

+ 1 - 0
requirements-ci.txt

@@ -2,6 +2,7 @@
 -e .
 
 # Requirements, in addition to coderedcms, needed for CI runner.
+codespell
 flake8
 pytest-cov
 pytest-django

+ 3 - 4
requirements-dev.txt

@@ -1,11 +1,10 @@
 # Install coderedcms from local directory.
 -e .
 
+# Everything from ci
+-r requirements-ci.txt
+
 # Requirements, in addition to coderedcms, needed for development.
-flake8
 libsass
-pytest-cov
-pytest-django
-sphinx
 twine
 wheel

Some files were not shown because too many files changed in this diff