Skip to content

Commit

Permalink
Merge master; add migrations file
Browse files Browse the repository at this point in the history
  • Loading branch information
sravfeyn committed Oct 25, 2024
2 parents 6c180df + 28856ea commit 80a6157
Show file tree
Hide file tree
Showing 951 changed files with 33,744 additions and 62,666 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = {
// https://eslint.org/docs/4.0.0/user-guide/configuring#specifying-parser-options
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
},

// http://eslint.org/docs/user-guide/configuring#specifying-environments
Expand Down
7 changes: 4 additions & 3 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,19 @@
/corehq/warehouse/ @calellowitz
/corehq/warnings.py @millerdev

/corehq/apps/accounting/ @dannyroberts @biyeun
/corehq/apps/accounting/ @dannyroberts @biyeun @nospame
/corehq/apps/analytics/ @biyeun
/corehq/apps/app_manager/ @orangejenny
/corehq/apps/callcenter/ @snopoke
/corehq/apps/case_search/ @orangejenny @MartinRiese @esoergel @AddisonDunn @stephherbers @Robert-Costello @Jtang-1 @nospame
/corehq/apps/case_search/ @orangejenny @MartinRiese @esoergel @AddisonDunn @stephherbers @Robert-Costello @Jtang-1
/corehq/apps/change_feed/ @dannyroberts
/corehq/apps/cleanup/management/commands/populate_sql_model_from_couch_model.py @millerdev
/corehq/apps/cloudcare/ @orangejenny @MartinRiese @AddisonDunn @stephherbers @Robert-Costello @Jtang-1 @nospame
/corehq/apps/cloudcare/ @MartinRiese @AddisonDunn @stephherbers @Robert-Costello @Jtang-1 @nospame
/corehq/apps/commtrack/ @esoergel
/corehq/apps/data_dictionary/ @esoergel @orangejenny @zandre-eng
/corehq/apps/domain/decorators.py @esoergel
/corehq/apps/domain/auth.py @esoergel
/corehq/apps/domain/views/accounting.py @nospame
/corehq/apps/es/ @esoergel @amitphulera
/corehq/apps/hqcase/ @esoergel
/corehq/apps/hqwebapp/ @orangejenny @biyeun
Expand Down
6 changes: 3 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## Product Description
<!-- For non-invisible changes, describe user-facing effects. -->
<!-- Where applicable, describe user-facing effects and include screenshots. -->

## Technical Summary
<!--
Provide a link to the ticket or document which prompted this change,
Describe the rationale and design decisions.
Provide a link to any tickets, design documents, and/or technical specifications
associated with this change. Describe the rationale and design decisions.
-->

## Feature Flag
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
name: "CodeQL"

on:
push:
branches: [ master ]
# push:
# branches: [ master ]
# pull_request:
# # The branches below must be a subset of the branches above
# branches: [ master ]
Expand All @@ -39,7 +39,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -50,7 +50,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -64,4 +64,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
schedule:
# see corehq/apps/hqadmin/management/commands/static_analysis.py
- cron: '47 12 * * *'
workflow_dispatch:
jobs:
tests:
runs-on: ubuntu-22.04
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,6 @@ corehq/apps/hqwebapp/static/hqwebapp/js/lib/modernizr.js
# direnv
.envrc
.direnv

# webpack build related
/webpack/_build/
5 changes: 5 additions & 0 deletions DEV_FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ Formplayer isn't running properly. See [Formplayer](https://github.com/dimagi/co
It happens, try restarting.

> I'm getting TemplateSyntaxErrors related to Webpack.
Please run `yarn dev`. If this build is failing, and you didn't make any changes to JavaScript files on your branch,
please raise this as an issue.

## Generating Sample Data

### SMS
Expand Down
72 changes: 20 additions & 52 deletions DEV_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,23 @@ This can also be used to promote a user created by signing up to a superuser.
Note that promoting a user to superuser status using this command will also give them the
ability to assign other users as superuser in the in-app Superuser Management page.
### Step 11: Running CommCare HQ
### Step 11: Running `yarn dev`
In order to build JavaScript bundles with Webpack, you will need to have `yarn dev`
running in the background. It will watch any existing Webpack Entry Point, aka modules
included on a page using the `js_entry` template tag.
When you add a new entry point (`js_entry` tag), please remember to restart `yarn dev` so
that it can identify the new entry point it needs to watch.
To build Webpack bundles like it's done in production environments, pleas use `yarn build`.
This command does not have a watch functionality, so it needs to be re-run every time you make
changes to javascript files bundled by Webpack.
For more information about JavaScript and Static Files, please see the
[Dimagi JavaScript Guide](https://commcare-hq.readthedocs.io/js-guide/README.html) on Read the Docs.
### Step 12: Running CommCare HQ
Make sure the required services are running (PostgreSQL, Redis, CouchDB, Kafka,
Elasticsearch).
Expand Down Expand Up @@ -794,6 +810,9 @@ yarn install --frozen-lockfile
./manage.py fix_less_imports_collectstatic
```
See the [Dimagi JavaScript Guide](https://commcare-hq.readthedocs.io/js-guide/README.html) for additional
useful background and tips.
## Running Formplayer and submitting data with Web Apps
Formplayer is a Java service that allows us to use applications on the web instead of on a mobile device.
Expand Down Expand Up @@ -1196,54 +1215,3 @@ This script goes through the steps to prepare a report for test coverage of
JavaScript files _that are touched by tests_, i.e., apps and files with 0% test
coverage will not be shown. A coverage summary is output to the terminal and a
detailed html report is generated at ``coverage-js/index.html``.
## Sniffer
You can also use sniffer to auto run the Python tests.
When running, sniffer auto-runs the specified tests whenever you save a file.
For example, you are working on the `retire` method of `CommCareUser`. You are
writing a `RetireUserTestCase`, which you want to run every time you make a
small change to the `retire` method, or to the `testCase`. Sniffer to the
rescue!
### Sniffer Usage
```sh
sniffer -x <test.module.path>[:<TestClass>[.<test_name>]]
```
In our example, we would run
```sh
sniffer -x corehq.apps.users.tests.retire:RetireUserTestCase`
```
You can also add the regular `nose` environment variables, like:
```sh
REUSE_DB=1 sniffer -x <test>
```
For JavaScript tests, you can add `--js-` before the JavaScript app test name,
for example:
```sh
sniffer -x --js-app_manager
```
You can combine the two to run the JavaScript tests when saving js files, and
run the Python tests when saving py files as follows:
```sh
sniffer -x --js-app_manager -x corehq.apps.app_manager:AppManagerViewTest
```
### Sniffer Installation instructions
<https://github.com/jeffh/sniffer/> (recommended to install `pywatchman` or
`macfsevents` for this to actually be worthwhile otherwise it takes a long time
to see the change).
8 changes: 3 additions & 5 deletions corehq/apps/accounting/decorators.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import json
from functools import wraps

from django.http import HttpResponse
from django.http import HttpResponse, JsonResponse

from django_prbac.decorators import requires_privilege
from django_prbac.exceptions import PermissionDenied
Expand Down Expand Up @@ -65,7 +64,7 @@ def requires_privilege_plaintext_response(slug,
"""
A version of the requires_privilege decorator which returns an
HttpResponse object with HTTP Status Code of 412 by default and
content_type of tex/plain if the privilege is not found.
content_type of text/plain if the privilege is not found.
"""
def decorate(fn):
@wraps(fn)
Expand Down Expand Up @@ -114,8 +113,7 @@ def wrapped(request, *args, **kwargs):
except PermissionDenied:
error_message = "You have lost access to this feature."
response = get_response(error_message, http_status_code)
return HttpResponse(json.dumps(response),
content_type="application/json", status=401)
return JsonResponse(response, status=401)
return wrapped
return decorate

Expand Down
Loading

0 comments on commit 80a6157

Please sign in to comment.