Skip to content

Commit

Permalink
Merge with develop and run js format/lint
Browse files Browse the repository at this point in the history
  • Loading branch information
apburnes committed Sep 6, 2018
2 parents 7c27691 + d1cc4f8 commit 906a570
Show file tree
Hide file tree
Showing 162 changed files with 7,826 additions and 3,993 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ jobs:
. .env/bin/activate
npm run build-js
npm run build-sass
cd fec
DJANGO_SETTINGS_MODULE=fec.settings.production python manage.py collectstatic --noinput -v 0
npm run test-single
pytest
- run:
name: Perform post-test checks
name: Perform post-test work
command: |
. .env/bin/activate
codecov
cd fec; DJANGO_SETTINGS_MODULE=fec.settings.production python manage.py collectstatic --noinput -v 0
- store_artifacts:
path: test-reports
Expand Down
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[run]
omit=*migrations*
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fec/fec/static/js/vendor/*
31 changes: 31 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
globals: {
'document': true,
'window': true,
'context': true,
'require': true,
'module': true,
'setTimeout': true,
'clearTimeout': true,
'ga': true
},
"extends": [
"plugin:react/recommended",
"eslint:recommended"
],
rules: {
'comma-dangle': ['error', 'never'],
'no-useless-escape': [0],
'prettier/prettier': 'error',
},
'parserOptions': {
'ecmaVersion': 6,
'sourceType': 'module',
'ecmaFeatures': {
'jsx': true
}
},
plugins: [
'prettier'
]
}
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"jsxBracketSameLine": false
}
111 changes: 5 additions & 106 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,111 +1,10 @@
## Welcome
We're glad you're thinking about contributing to an 18F open source project! If you're unsure about anything, ask us — or submit the issue or pull request anyway. The worst that can happen is that we’ll politely ask you to change something.
We're glad you're thinking about contributing to an FEC open source project! If you're unsure about anything, ask us — or submit the issue or pull request anyway. The worst that can happen is that we’ll politely ask you to change something.

We love all friendly contributions, and we welcome your ideas about how to make the FEC's online presence more user friendly, accessible, and elegant.
We love all friendly contributions, and we welcome your ideas about how to make the FEC's online presence more user friendly, accessible and elegant.

To ensure a welcoming environment for our projects, our staff follows the [18F Code of Conduct](https://github.com/18F/code-of-conduct/blob/master/code-of-conduct.md); contributors should do the same. Please also check out the [18F Open Source Policy GitHub repository]( https://github.com/18f/open-source-policy).
To ensure a welcoming environment for our projects, our staff follows the FEC Code of Conduct [pending]; contributors should do the same. Please also check out the [FEC Open Source Policy](https://github.com/fecgov/FEC/blob/master/OPEN-SOURCE-POLICY.md).

If you’d prefer, you can also reach us by [email](mailto:betafeedback@fec.gov).
If you’d prefer, you can also reach us by [email](mailto:opensource@fec.gov).

## Public domain
All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest.

### Issues
We use GitHub issues to track user issues and team tasks. Whenever possible, we follow this outline:

1. Goal: a quick blurb explaining the bug or what the issue should accomplish. What is the user need?
2. Completion criteria: how we’ll know that this issue has been completed
3. Tasks to completion:
- [ ] Use
- [ ] Markdown
- [ ] Checklists
4. Dependencies (optional): What other issues out there need to be completed before you can do this one? Include links to tickets with the dependency.

## Pull request and branching guidance

### Pull requests

#### Writing a pull request
Authoring a good pull request saves time for both the developer and anyone reviewing changes in code. It re-enforces the purpose and validity of the code change and it also makes it easier for reviewers to understand the changes at a glance before diving in.

**Do:**

* Use a descriptive but succinct title
* Try to keep it under 75 characters
* Use a _verb/adjective_ aimed at a particular **feature**:
*_New_ **meetings archive** page,”
*_Changes_ to **candidate page** design,”
*_Fix_ for **election page** button”
* Follow the pre-populated fields in the pull request template. Remember to delete fields you don’t use.
* Include a summary that describes components that will be affected in the application
* Include issue number(s) and other related PRs
* Add screenshots, short videos, or gifs
* When there are changes to styling or to the interface, a before/after image is helpful
* In interactive features, an animated gif captures the movement and activity
* Check to remove `print` statements and commented out code
* Lint your code and double check indents and make sure to use proper spacing

**Don’t:**

* Use overly verbose or technically detailed PR titles.
* “New class .foo-bar on profile sections plus javascript changes on design pages,” could be “New interactions and designs for Committee profiles,”
* “Tooltips on calendar now works when hovered with points” could be “Fixes for Calendar tooltips”
* Leave unused blank fields in the pull request template when you submit it


##### Resources

* An [article about writing effective pull requests](https://www.atlassian.com/blog/git/written-unwritten-guide-pull-requests) from Atlassian.
* An [article on writing good commit messages](https://chris.beams.io/posts/git-commit/) by Chris Beams


### Branching

#### Feature development branching
If you are developing a new feature, you can make a branch `feature/name-of-new-feature` but you can also use git flow to start it using `git flow feature start name-of-new-feature`.

#### Quick fix branching
Branches for fixes to an existing feature or modifications to the general codebase that are not critical (in other words, can wait until the next scheduled release) can be established as a feature with a name starting with “fix-” to differentiate themselves from full fledged features, for example `feature/fix-broken-button`.

#### Work in progress (WIP)
Work in progress PRs may be helpful to show that a feature is in active development for an extended period of time, especially if you're collaborating with other folks on an issue. Generally speaking, work shouldn't sit unmerged for long periods of time (that is a development antipattern), but in some cases this is preferred as it helps facilitate communication between team members and provides visibility into ongoing work. Furthermore, it will allow the tests to run in CircleCI, which provides you with feedback as you work. You should be pushing your commits regularly as you make progress so that you receive automated testing feedback early and often to take advantage of this!

If you are intentially opening a PR early and intend it to be a work in progress, please do the following:

- Put `[WIP]` at the start of the PR title
- Place `WIP: PLEASE DO NOT MERGE` in bold at the top of the PR description

When the PR is ready for full review and no longer a WIP, please remove these two items.

### Committing work in a branch
When you begin to work in a branch, you'll want to follow these guidelines for the commits you will make before you push them remotely:

- Good commit messages start with a verb, like “adds” or “changes” or “removes.”
- Be sure to talk about the nature of the change you're making. Explain why the change is needed, rather than simply describing the bug or task it addresses.
- If your commit resolves an issue, reference it in the commit messages. For example “fixes #555.” Read more GitHub guidance on [closing issues via commit messages](https://help.github.com/articles/closing-issues-via-commit-messages/).
- We encourage you to follow the [50/72 format](http://stackoverflow.com/questions/2290016/git-commit-messages-50-72-formatting).

### Ready for review

#### Labeling
After you open the PRs and it’s ready for review, apply the label “plz-review” and tag a specific person to review it. If the PRs needs to be included in the next release, apply the “Before release” label so that reviewers recognize that it’s a priority.

#### Getting a PR review
Sometimes tagging a reviewer may not be enough. If a PR needs to be reviewed in a timely manner, reach out to folks individually to ask for help as they may not know the urgency of the PR needing a review.

#### Reviewing a pull request
Reviewing pull requests is not always easy and reviewers should make sure to block out time in their schedule so they are not rushed. Always make sure to pull down the branch and test the work on your local machine. DO NOT BLINDLY MERGE IN PRS YOU DO NOT UNDERSTAND. Do not feel shy about asking questions and requesting the author of the pull request to explain certain sections of their code. That is the purpose of a code review.

##### Resources
* [Tips for code reviews](http://engineering.khanacademy.org/posts/tips-for-code-reviews.htm) from Khan Academy

### Urgent fixes between releases

#### Hotfixes
To reiterate the [onboarding documentation](https://docs.google.com/document/d/18ZjPvNrdW3wn9pUx7hSNbaMlaEaPPOGzOHh-WjLiVOg/edit#heading=h.8a6bhbb6fbdz):<br>
<br>
_“A hotfix is intended to address an issue that is having a critical impact to the production site that must be remediated outside of the normal release schedule. These should very much be the exception, not the rule, but they do come up from time to time and can range from a glaring typo to something that brings down core functionality (e.g., an API endpoint failing).”_<br>
<br>
Hotfixes should only address urgent issues that are determined by project managers to be a critical detriment to production. Otherwise, fixes and updates can be rolled into the next release. If there is a large number of hotfixes needed, the team should consider making an extra mid-sprint mini release instead of deploying several hotfixes.<br>
<br>
A detailed step-by-step guide to creating hotfixes can be found in the [onboarding documentation](https://docs.google.com/document/d/18ZjPvNrdW3wn9pUx7hSNbaMlaEaPPOGzOHh-WjLiVOg/edit#heading=h.8a6bhbb6fbdz).
For our full contributing guidelines, please see our [Default Contributor License Agreement](https://github.com/fecgov/FEC/blob/master/CONTRIBUTING.md).
75 changes: 1 addition & 74 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,77 +5,4 @@ This project includes a mix of the following:
* Open source works that are not in the public domain
* Open source work by the U.S. government that is in the public domain

## Parts of this project that are not in the public domain

### Files licensed under the SIL Open Font License

The Karla font files in `fec-cms/fec/fec/static/fonts/` are from [Google Web Fonts](https://fonts.google.com/specimen/Karla), licensed under the [SIL Open Font License](http://scripts.sil.org/cms/scripts/page.php?item_id=OFL), and copyright [Jonny Pinhorn](https://github.com/jonpinhorn) with Reserved Font Name ‘Karla'.


### Files licensed under another license

The Gandhi Serif font files in `fec-cms/fec/fec/static/fonts/` are from [Librerias Gandhi](http://www.tipografiagandhi.com/), and copyright 2012 [Librerias Gandhi S.A. de C.V.](http://www.gandhi.com.mx/) with Reserved Font Name ‘Gandhi Serif’. The English version of this License is reproduced below.

#### Full English version of the license text for Gandhi Serif:

```
Conditions of use
You may:
- Install the fonts on as many devices as you wish.
- Distribute the fonts to anyone you wish.
- Use the fonts in any commercial or non-commercial document.
- Save the fonts in a format that would best fit your purposes.
You may not:
- Modify the fonts in a font editor software.
- Sell or rent out the fonts.
Notes:
- The fonts and any other accompanying written or electronic materials are provided "as is" without warranty of any kind, expressed or implied. The authors do not warrant that the functions contained in the fonts will meet the user's requirements.
- The authors shall not be liable for any direct, indirect, consequential, or incidental damages (including damages from loss of business profits, business interruption, loss of business information, and the like) arising out of the use of or inability to use the fonts.
```
## Image licenses

This site also includes a number of images that have various copyright statuses, including Creative Commons licenses and public domain. These images are in the `fec-cms/fec/fec/static/img/` directory.

## The rest of this project is in the worldwide public domain

As a work of the United States government, this project is in the public domain within the United States.

Additionally, we waive copyright and related rights in the work worldwide through the [CC0 1.0 Universal public domain dedication](https://creativecommons.org/publicdomain/zero/1.0/).

### CC0 1.0 universal summary
What follows is a human-readable summary of the Legal Code. [Read the full text](https://creativecommons.org/publicdomain/zero/1.0/legalcode).

#### No copyright
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of his or her rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law.

You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

### FEC data exceptions

A few restrictions limit the way you can use FEC data. For example, you can’t use contributor lists for commercial purposes or to solicit donations. [Learn more on FEC.gov.](https://transition.fec.gov/pages/brochures/saleuse.shtml)

#### Other information
In no way are the patent or trademark rights of any person affected by CC0, nor are the rights that other persons may have in the work or in how the work is used, such as publicity or privacy rights.

Unless expressly stated otherwise, the person who associated a work with this deed makes no warranties about the work, and disclaims liability for all uses of the work, to the fullest extent permitted by applicable law. When using or citing the work, you should not imply endorsement by the author or the affirmer.

## Reuse of open-source style guides
Much of the design, guidance, and code in the FEC style guide is based on user interface (UI) patterns from the [U.S. Web Design Standards](https://standards.usa.gov/), including:
- Grid column classes: [/scss/_grid.scss](/blob/master/scss/_grid.scss)
- Some colors in the color palette: [/scss/_variables.scss](/blob/master/scss/_variables.scss)
- Header navigation with mega menu
- Footer navigation and guidance
- Side navigation

### Contributions to this project

As stated in [CONTRIBUTING](CONTRIBUTING.md), all contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest.






Please see our [Default License](https://github.com/fecgov/FEC/blob/master/LICENSE.md).
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
**Develop**
[![CircleCI](https://circleci.com/gh/fecgov/fec-cms.svg?style=svg)](https://circleci.com/gh/fecgov/fec-cms)
[![Test Coverage](https://img.shields.io/codecov/c/github/fecgov/fec-cms/develop.svg)](https://codecov.io/github/fecgov/fec-cms)

**Master**
[![Known Vulnerabilities](https://snyk.io/test/github/fecgov/fec-cms/badge.svg)](https://snyk.io/test/github/fecgov/fec-cms)
[![Test Coverage](https://img.shields.io/codecov/c/github/fecgov/fec-cms/master.svg)](https://codecov.io/github/fecgov/fec-cms)

## Campaign finance for everyone
The Federal Election Commission (FEC) releases information to the public about
Expand Down Expand Up @@ -177,20 +179,21 @@ npm run test-single

*Note: You may be prompted to allow `node` to accept connections; this is okay and required for the tests to run.*

To run the Python tests, run these commands in the root project directory:
To run the Python tests, run this command in the root project directory:

```bash
cd fec/
./manage.py test
pytest
```

It's necessary to specify the Postgresql URL, which can be done on the
command line, e.g.:

```bash
env DATABASE_URL=postgresql://:@/cfdm_cms_test ./manage.py test
env DATABASE_URL=postgresql://:@/cfdm_cms_test pytest
```

`pytest` is configured to report test coverage automatically.

## Enabling/toggling features
[settings/base.py](https://github.com/fecgov/fec-cms/blob/develop/fec/fec/settings/base.py)
includes a set of `FEATURES` which can also be enabled using environment flags:
Expand Down Expand Up @@ -227,6 +230,12 @@ Lastly run migrations to account for any very recent changes that are not presen
run this command:
`./manage.py migrate`

### Generating code.json

Code.gov uses the code.json file located at fec.gov/code.json to inventory our repositories. The file is generated using [LLNL's scraper tool](https://github.com/LLNL/scraper). Follow the instructions in scraper's README file to generate a new code.json, or manually update as needed.

Examples of code.json files: https://github.com/GSA/code-gov/blob/master/METADATA_EXAMPLES.md

## Deploy
*Likely only useful for FEC team members*

Expand Down
10 changes: 0 additions & 10 deletions bin/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@ set -o pipefail
cd fec
# Run migrations
./manage.py makemigrations
./manage.py migrate wagtailadmin
./manage.py migrate wagtailcore
./manage.py migrate wagtaildocs
./manage.py migrate wagtailembeds
./manage.py migrate wagtailforms
./manage.py migrate wagtailimages
./manage.py migrate wagtailredirects
./manage.py migrate wagtailsearch
./manage.py migrate wagtailsearchpromotions
./manage.py migrate wagtailusers
./manage.py migrate --noinput

# Run application
Expand Down
Loading

0 comments on commit 906a570

Please sign in to comment.