Skip to content

Commit

Permalink
Apply prettier 2 (oppia#19862)
Browse files Browse the repository at this point in the history
* apply prettier

* fix compilation warnings, skip test with reduced coverage

* add prettier github action
  • Loading branch information
nikitaevg authored Mar 12, 2024
1 parent 7bd0d64 commit 2ae9b98
Show file tree
Hide file tree
Showing 2,989 changed files with 367,582 additions and 286,956 deletions.
24 changes: 12 additions & 12 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@ appearance, race, religion, or sexual identity and orientation.
Examples of behavior that contributes to creating a positive environment
include:

* Being available to help other contributors.
* Being respectful of differing viewpoints and experiences.
* Focusing on teaching-oriented communication so that each contributor gets a chance to learn and grow.
* Focusing on what is best for the Oppia community.
* Gracefully accepting constructive criticism.
* Showing empathy towards other community members.
* Using welcoming and inclusive language.
- Being available to help other contributors.
- Being respectful of differing viewpoints and experiences.
- Focusing on teaching-oriented communication so that each contributor gets a chance to learn and grow.
- Focusing on what is best for the Oppia community.
- Gracefully accepting constructive criticism.
- Showing empathy towards other community members.
- Using welcoming and inclusive language.

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
- The use of sexualized language or imagery and unwelcome sexual attention or
advances.
* Trolling, insulting/derogatory comments, and personal or political attacks.
* Public or private harassment.
* Publishing others' private information, such as a physical or electronic
- Trolling, insulting/derogatory comments, and personal or political attacks.
- Public or private harassment.
- Publishing others' private information, such as a physical or electronic
address, without explicit permission.
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting.

## Our Responsibilities
Expand Down
10 changes: 5 additions & 5 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ There are lots of ways to help out and become an Oppia contributor, from joining

To make it easier to get started, we've catalogued some of the different ways to help out. Please feel free to take a look through them, and see if any interest you:

* [Coders](https://github.com/oppia/oppia/wiki/Contributing-code-to-Oppia)
* [Instructional designers and storytellers](https://github.com/oppia/oppia/wiki/Teaching-with-Oppia)
* [UX researchers](https://github.com/oppia/oppia/wiki/Conducting-research-with-students)
* [Voice artists](https://github.com/oppia/oppia/wiki/Instructions-for-voice-artists)
* [Designers and artists](https://github.com/oppia/oppia/wiki/Contributing-to-Oppia%27s-design)
- [Coders](https://github.com/oppia/oppia/wiki/Contributing-code-to-Oppia)
- [Instructional designers and storytellers](https://github.com/oppia/oppia/wiki/Teaching-with-Oppia)
- [UX researchers](https://github.com/oppia/oppia/wiki/Conducting-research-with-students)
- [Voice artists](https://github.com/oppia/oppia/wiki/Instructions-for-voice-artists)
- [Designers and artists](https://github.com/oppia/oppia/wiki/Contributing-to-Oppia%27s-design)

If you are interested in working on Oppia's Android app, you should also take a look at the [oppia/oppia-android repository](https://github.com/oppia/oppia-android).

Expand Down
11 changes: 6 additions & 5 deletions .github/ISSUE_TEMPLATE/4_server_error_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Server error
about: Report a production bug from the server logs
labels: triage needed, server errors, bug
---

<!--
- Before filing a new issue, please do a quick search to check that it hasn't
- already been filed on the [issue tracker](https://github.com/oppia/oppia/issues)._
Expand All @@ -25,8 +26,8 @@ Add error logs here.
**General instructions for contributors**
In general, the procedure for fixing server errors should be the following:

* Analyze the code in the file where the error occurred and come up with a hypothesis for the reason.
* Based on your hypothesis, determine a list of steps that reliably reproduce the issue (or confirm any repro instructions that have been provided). For example, if your hypothesis is that the issue arises due to a delay in a response from the backend server, try to change the code so that the backend server always has a delay, and see if the error then shows up 100% of the time on your local machine.
* Explain your proposed fix, the logic behind it, and any other findings/context you have on this thread. You can also link to a [debugging doc](https://docs.google.com/document/d/1qRbvKjJ0A7NPVK8g6XJNISMx_6BuepoCL7F2eIfrGqM/edit) if you prefer.
* Get your approach validated by an Oppia team member.
* Make a PR that fixes the issue.
- Analyze the code in the file where the error occurred and come up with a hypothesis for the reason.
- Based on your hypothesis, determine a list of steps that reliably reproduce the issue (or confirm any repro instructions that have been provided). For example, if your hypothesis is that the issue arises due to a delay in a response from the backend server, try to change the code so that the backend server always has a delay, and see if the error then shows up 100% of the time on your local machine.
- Explain your proposed fix, the logic behind it, and any other findings/context you have on this thread. You can also link to a [debugging doc](https://docs.google.com/document/d/1qRbvKjJ0A7NPVK8g6XJNISMx_6BuepoCL7F2eIfrGqM/edit) if you prefer.
- Get your approach validated by an Oppia team member.
- Make a PR that fixes the issue.
3 changes: 2 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## Overview

<!--
READ ME FIRST:
Please answer *all* questions below and check off every point from the Essential Checklist!
Expand Down Expand Up @@ -27,10 +28,10 @@ and link to the job request doc here.
Otherwise, please delete this section.
-->

- [ ] A testing doc has been written: ... (ADD LINK) ...
- [ ] _(To be confirmed by the server admin)_ All jobs in this PR have been verified on a live server, and the PR is safe to merge.


## Proof that changes are correct

<!--
Expand Down
25 changes: 12 additions & 13 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ In addition to developing the Oppia platform, the team is also developing and pi

Oppia is written using Python and AngularJS, and is built on top of Google App Engine. See also:

* [Oppia.org community site](https://www.oppia.org)
* [User Documentation](https://oppia.github.io/)
* [Contributors' wiki](https://github.com/oppia/oppia/wiki)
* [GitHub Discussions](https://github.com/oppia/oppia/discussions)
* [Developer announcements](http://groups.google.com/group/oppia-dev)
* [File an issue](https://github.com/oppia/oppia/issues/new/choose)
- [Oppia.org community site](https://www.oppia.org)
- [User Documentation](https://oppia.github.io/)
- [Contributors' wiki](https://github.com/oppia/oppia/wiki)
- [GitHub Discussions](https://github.com/oppia/oppia/discussions)
- [Developer announcements](http://groups.google.com/group/oppia-dev)
- [File an issue](https://github.com/oppia/oppia/issues/new/choose)

You can also sign up to our [email newsletter](https://shorturl.at/CHPY6) for news and updates about the overall Oppia project.

Expand All @@ -30,30 +30,29 @@ Please refer to the [Installing Oppia page](https://github.com/oppia/oppia/wiki/
The Oppia project is built by the community for the community. We welcome contributions from everyone, especially new contributors.

You can help with Oppia's development in many ways, including art, coding, design and documentation.
* **Developers**: please see [this wiki page](https://github.com/oppia/oppia/wiki/Contributing-code-to-Oppia#setting-things-up) for instructions on how to set things up and commit changes.
* **All other contributors**: please see our [general contributor guidelines](https://github.com/oppia/oppia/wiki).

If you'd like to donate to support our work, you can do so [here](https://www.oppia.org/donate).
- **Developers**: please see [this wiki page](https://github.com/oppia/oppia/wiki/Contributing-code-to-Oppia#setting-things-up) for instructions on how to set things up and commit changes.
- **All other contributors**: please see our [general contributor guidelines](https://github.com/oppia/oppia/wiki).

If you'd like to donate to support our work, you can do so [here](https://www.oppia.org/donate).

## Support

If you have any feature requests or bug reports, please log them on our [issue tracker](https://github.com/oppia/oppia/issues/new/choose).

Please report security issues directly to [email protected].


## License

The Oppia code is released under the [Apache v2 license](https://github.com/oppia/oppia/blob/develop/LICENSE).


## Keeping in touch

* [Discussion forum](https://github.com/oppia/oppia/discussions)
* [Announcements mailing list](http://groups.google.com/group/oppia-announce)
- [Discussion forum](https://github.com/oppia/oppia/discussions)
- [Announcements mailing list](http://groups.google.com/group/oppia-announce)

## Social Media

[<img height="30" src="https://img.shields.io/badge/twitter-1DA1F2.svg?&style=for-the-badge&logo=twitter&logoColor=white" />][twitter] [<img height="30" src="https://img.shields.io/badge/linkedin-0077B5.svg?&style=for-the-badge&logo=linkedin&logoColor=white" />][LinkedIn] [<img height="30" src = "https://img.shields.io/badge/facebook-1877F2.svg?&style=for-the-badge&logo=facebook&logoColor=white">][Facebook] [<img height="30" src = "https://img.shields.io/badge/medium-12100E.svg?&style=for-the-badge&logo=medium&logoColor=white">][medium] [<img height="30" src = "https://img.shields.io/badge/oppia.org%20youtube-FF0000.svg?&style=for-the-badge&logo=youtube&logoColor=white">][oppia-org-youtube] [<img height="30" src = "https://img.shields.io/badge/oppia%20dev%20youtube-FF0000.svg?&style=for-the-badge&logo=youtube&logoColor=white">][dev-youtube]

[twitter]: https://twitter.com/oppiaorg
Expand Down
34 changes: 17 additions & 17 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ This vulnerability disclosure process describes how we accept and respond to sec

Reporters should email [[email protected]](mailto:[email protected]) or open a [GitHub Security Vulnerability Report](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability) with:

* A description of the problem.
* Steps we can follow to reproduce the problem.
* Affected versions.
* If known, mitigations for the problem.
- A description of the problem.
- Steps we can follow to reproduce the problem.
- Affected versions.
- If known, mitigations for the problem.

We will respond within 3 days of the reporter's submission to acknowledge receipt of their report. Here is a template acknowledgement message:

Expand All @@ -27,27 +27,27 @@ $OPPIA_SECURITY_TEAM_MEMBER

Immediately upon receiving a report of a security problem, a member of Oppia’s security team (the tech leads for now) will assemble a vulnerability response team (VRT). This team should:

* Include an Oppia tech lead.
* Include developers (most likely 1-2) with expertise in the part of the app affected by the problem.
* Include as few developers as possible to avoid premature publication of the problem.
- Include an Oppia tech lead.
- Include developers (most likely 1-2) with expertise in the part of the app affected by the problem.
- Include as few developers as possible to avoid premature publication of the problem.

The tech lead will designate one VRT member as the VRT lead responsible for driving our response. The VRT lead will immediately (ideally within 24 hours) investigate the report and classify it as:

* **Won’t fix**: The app is working as intended, the bug is not important enough for us to spend resources fixing, or the requested feature is not something we plan to implement.
- **Won’t fix**: The app is working as intended, the bug is not important enough for us to spend resources fixing, or the requested feature is not something we plan to implement.

* **Bug**: The problem identified is legitimate, but it is not a security issue. It will be resolved through our normal bug-fixing process.
- **Bug**: The problem identified is legitimate, but it is not a security issue. It will be resolved through our normal bug-fixing process.

* **Feature request**: The report identifies a new feature that should be implemented. It will be handled through our normal feature-development process.
- **Feature request**: The report identifies a new feature that should be implemented. It will be handled through our normal feature-development process.

* **Low-severity vulnerability**: The report identifies a security vulnerability that does not meet the high-severity criteria. It will be resolved through our normal bug-fixing process. A "security vulnerability" is unintended behavior with security implications. This is distinct from a feature request, which refers to cases where the code behaves as intended, but the reporter disagrees with that intention.
- **Low-severity vulnerability**: The report identifies a security vulnerability that does not meet the high-severity criteria. It will be resolved through our normal bug-fixing process. A "security vulnerability" is unintended behavior with security implications. This is distinct from a feature request, which refers to cases where the code behaves as intended, but the reporter disagrees with that intention.

For example, suppose we improperly sanitized user-provided data at the models layer such that user-provided code could be executed, but validation checks at the controller layer prevented an attacker from actually exploiting the vulnerability. This would be a security vulnerability because we do not intend for the models layer to allow user-provided code to execute, but it would be low-severity because the controllers layer would prevent exploitation.

* **High-severity vulnerability**: The report identifies an exploitable security vulnerability that, if exploited, could result in any of the following:
- **High-severity vulnerability**: The report identifies an exploitable security vulnerability that, if exploited, could result in any of the following:

* (Confidentiality) Unauthorized access to any sensitive data that shouldn't be made public. Here, "sensitive data" generally refers to both private user data, as well as information that could be used to gain access to private user data; if in doubt, consult the data owners.
* (Integrity) Unauthorized edits to any data.
* (Availability) Degraded system performance of the platform for users.
- (Confidentiality) Unauthorized access to any sensitive data that shouldn't be made public. Here, "sensitive data" generally refers to both private user data, as well as information that could be used to gain access to private user data; if in doubt, consult the data owners.
- (Integrity) Unauthorized edits to any data.
- (Availability) Degraded system performance of the platform for users.

Note that while the VRT contains multiple individuals, it’s ultimately expected that the VRT lead drives the effort. This should be in collaboration with VRT members, but in cases of urgent vulnerabilities the VRT lead can operate authoritatively to mitigate or remediate the issue (i.e. they do not need VRT consensus or review, but they should leverage VRT team members as a source for information and help).

Expand All @@ -61,8 +61,8 @@ The rest of this document describes how we handle high-severity vulnerabilities.

If the problem is confirmed as a high-severity vulnerability, the VRT will open a [GitHub security advisory](https://docs.github.com/en/code-security/repository-security-advisories/about-github-security-advisories-for-repositories) and, if both the VRT and reporter agree, add the reporter to the advisory so we can collaborate on it. We will coordinate work on the vulnerability via:

* **The GitHub security advisory.** These advisories will let us collaborate in private, and they are appropriate in cases where disclosing the vulnerability prior to remediating it could put our users or developers at risk.
* **(Optionally) An additional GitHub issue and pull request.** This will immediately disclose the vulnerability, and we will take this approach when immediate disclosure poses little risk to our users and developers. For example, when the vulnerability is already publicly known. Unlike security advisories, CI checks can run on these PRs.
- **The GitHub security advisory.** These advisories will let us collaborate in private, and they are appropriate in cases where disclosing the vulnerability prior to remediating it could put our users or developers at risk.
- **(Optionally) An additional GitHub issue and pull request.** This will immediately disclose the vulnerability, and we will take this approach when immediate disclosure poses little risk to our users and developers. For example, when the vulnerability is already publicly known. Unlike security advisories, CI checks can run on these PRs.

Note that we will create a GitHub security advisory even if we choose to collaborate on a fix using an open issue or PR because we’ll want to publish the advisory when disclosing the vulnerability.

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
## Note on splitting of e2e workflows

The e2e test suites are split into workflows such that each workflow takes
approximately the same time to run.
49 changes: 49 additions & 0 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Check code is formatted with prettier
on:
merge_group:
types: [checks_requested]
push:
branches:
- develop
- release-*
pull_request:
branches:
- develop
- release-*

jobs:
run_prettier:
name: Run prettier on the whole codebase
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8.15'
architecture: 'x64'
- uses: ./.github/actions/merge
- name: Cache node modules and third_party/static
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: |
/home/runner/work/oppia/yarn_cache
/home/runner/work/oppia/oppia/third_party/static
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('yarn.lock', 'dependencies.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- uses: ./.github/actions/install-oppia-dependencies
- name: Prettify code
run: npx prettier --check .
- name: Report failure if failed on oppia/oppia develop branch
if: ${{ failure() && github.event_name == 'push' && github.repository == 'oppia/oppia' && github.ref == 'refs/heads/develop'}}
uses: ./.github/actions/send-webhook-notification
with:
message: "Prettier formatting failed on the upstream develop branch."
webhook-url: ${{ secrets.BUILD_FAILURE_ROOM_WEBHOOK_URL }}
Loading

0 comments on commit 2ae9b98

Please sign in to comment.