Lint markdown and require markdown changes to pass prettier (#1510)

* Require that markdown files are linted by prettier
This commit is contained in:
Kevin Chung
2020-06-24 14:04:10 -04:00
committed by GitHub
parent a61ff68458
commit aa225f8e15
6 changed files with 813 additions and 787 deletions

View File

@@ -6,9 +6,9 @@ If this is a feature request please describe the behavior that you'd like to see
**Environment**: **Environment**:
- CTFd Version/Commit: - CTFd Version/Commit:
- Operating System: - Operating System:
- Web Browser and Version: - Web Browser and Version:
**What happened?** **What happened?**
@@ -17,4 +17,3 @@ If this is a feature request please describe the behavior that you'd like to see
**How to reproduce your issue** **How to reproduce your issue**
**Any associated stack traces or error logs** **Any associated stack traces or error logs**

File diff suppressed because it is too large Load Diff

View File

@@ -2,20 +2,20 @@
#### **Did you find a bug?** #### **Did you find a bug?**
* **Do not open up a GitHub issue if the bug is a security vulnerability in CTFd**. Instead [email the details to us at support@ctfd.io](mailto:support@ctfd.io). - **Do not open up a GitHub issue if the bug is a security vulnerability in CTFd**. Instead [email the details to us at support@ctfd.io](mailto:support@ctfd.io).
* **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/CTFd/CTFd/issues). - **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/CTFd/CTFd/issues).
* If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/CTFd/CTFd/issues/new). Be sure to fill out the issue template with a **title and clear description**, and as much relevant information as possible (e.g. deployment setup, browser version, etc). - If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/CTFd/CTFd/issues/new). Be sure to fill out the issue template with a **title and clear description**, and as much relevant information as possible (e.g. deployment setup, browser version, etc).
#### **Did you write a patch that fixes a bug or implements a new feature?** #### **Did you write a patch that fixes a bug or implements a new feature?**
* Open a new pull request with the patch. - Open a new pull request with the patch.
* Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable. - Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.
* Ensure all status checks pass. PR's with test failures will not be merged. PR's with insufficient coverage may be merged depending on the situation. - Ensure all status checks pass. PR's with test failures will not be merged. PR's with insufficient coverage may be merged depending on the situation.
#### **Did you fix whitespace, format code, or make a purely cosmetic patch?** #### **Did you fix whitespace, format code, or make a purely cosmetic patch?**
Changes that are cosmetic in nature and do not add anything substantial to the stability, functionality, or testability of CTFd will generally not be accepted. Changes that are cosmetic in nature and do not add anything substantial to the stability, functionality, or testability of CTFd will generally not be accepted.

View File

@@ -7,18 +7,18 @@ This CTFd plugin creates a dynamic challenge type which implements this
behavior. Each dynamic challenge starts with an initial point value and then behavior. Each dynamic challenge starts with an initial point value and then
each solve will decrease the value of the challenge until a minimum point value. each solve will decrease the value of the challenge until a minimum point value.
By reducing the value of the challenge on each solve, all users who have previously By reducing the value of the challenge on each solve, all users who have previously
solved the challenge will have lowered scores. Thus an easier and more solved solved the challenge will have lowered scores. Thus an easier and more solved
challenge will naturally have a lower point value than a harder and less solved challenge will naturally have a lower point value than a harder and less solved
challenge. challenge.
Within CTFd you are free to mix and match regular and dynamic challenges. Within CTFd you are free to mix and match regular and dynamic challenges.
The current implementation requires the challenge to keep track of three values: The current implementation requires the challenge to keep track of three values:
* Initial - The original point valuation - Initial - The original point valuation
* Decay - The amount of solves before the challenge will be at the minimum - Decay - The amount of solves before the challenge will be at the minimum
* Minimum - The lowest possible point valuation - Minimum - The lowest possible point valuation
The value decay logic is implemented with the following math: The value decay logic is implemented with the following math:
@@ -43,12 +43,12 @@ If the number generated is lower than the minimum, the minimum is chosen
instead. instead.
A parabolic function is chosen instead of an exponential or logarithmic decay function A parabolic function is chosen instead of an exponential or logarithmic decay function
so that higher valued challenges have a slower drop from their initial value. so that higher valued challenges have a slower drop from their initial value.
# Installation # Installation
**REQUIRES: CTFd >= v1.2.0** **REQUIRES: CTFd >= v1.2.0**
1. Clone this repository to `CTFd/plugins`. It is important that the folder is 1. Clone this repository to `CTFd/plugins`. It is important that the folder is
named `DynamicValueChallenge` so CTFd can serve the files in the `assets` named `DynamicValueChallenge` so CTFd can serve the files in the `assets`
directory. directory.

View File

@@ -3,11 +3,13 @@ lint:
yarn lint yarn lint
black --check --exclude=CTFd/uploads --exclude=node_modules . black --check --exclude=CTFd/uploads --exclude=node_modules .
prettier --check 'CTFd/themes/**/assets/**/*' prettier --check 'CTFd/themes/**/assets/**/*'
prettier --check '**/*.md'
format: format:
isort --skip=CTFd/uploads -rc CTFd/ tests/ isort --skip=CTFd/uploads -rc CTFd/ tests/
black --exclude=CTFd/uploads --exclude=node_modules . black --exclude=CTFd/uploads --exclude=node_modules .
prettier --write 'CTFd/themes/**/assets/**/*' prettier --write 'CTFd/themes/**/assets/**/*'
prettier --write '**/*.md'
test: test:
pytest -rf --cov=CTFd --cov-context=test --ignore=node_modules/ \ pytest -rf --cov=CTFd --cov-context=test --ignore=node_modules/ \

View File

@@ -1,47 +1,49 @@
![](https://github.com/CTFd/CTFd/blob/master/CTFd/themes/core/static/img/logo.png?raw=true) # ![](https://github.com/CTFd/CTFd/blob/master/CTFd/themes/core/static/img/logo.png?raw=true)
====
[![Build Status](https://travis-ci.org/CTFd/CTFd.svg?branch=master)](https://travis-ci.org/CTFd/CTFd) [![Build Status](https://travis-ci.org/CTFd/CTFd.svg?branch=master)](https://travis-ci.org/CTFd/CTFd)
[![MajorLeagueCyber Discourse](https://img.shields.io/discourse/status?server=https%3A%2F%2Fcommunity.majorleaguecyber.org%2F)](https://community.majorleaguecyber.org/) [![MajorLeagueCyber Discourse](https://img.shields.io/discourse/status?server=https%3A%2F%2Fcommunity.majorleaguecyber.org%2F)](https://community.majorleaguecyber.org/)
[![Documentation Status](https://readthedocs.org/projects/ctfd/badge/?version=latest)](https://docs.ctfd.io/en/latest/?badge=latest) [![Documentation Status](https://readthedocs.org/projects/ctfd/badge/?version=latest)](https://docs.ctfd.io/en/latest/?badge=latest)
## What is CTFd? ## What is CTFd?
CTFd is a Capture The Flag framework focusing on ease of use and customizability. It comes with everything you need to run a CTF and it's easy to customize with plugins and themes. CTFd is a Capture The Flag framework focusing on ease of use and customizability. It comes with everything you need to run a CTF and it's easy to customize with plugins and themes.
![CTFd is a CTF in a can.](https://github.com/CTFd/CTFd/blob/master/CTFd/themes/core/static/img/scoreboard.png?raw=true) ![CTFd is a CTF in a can.](https://github.com/CTFd/CTFd/blob/master/CTFd/themes/core/static/img/scoreboard.png?raw=true)
## Features ## Features
* Create your own challenges, categories, hints, and flags from the Admin Interface
* Dynamic Scoring Challenges - Create your own challenges, categories, hints, and flags from the Admin Interface
* Unlockable challenge support - Dynamic Scoring Challenges
* Challenge plugin architecture to create your own custom challenges - Unlockable challenge support
* Static & Regex based flags - Challenge plugin architecture to create your own custom challenges
* Custom flag plugins - Static & Regex based flags
* Unlockable hints - Custom flag plugins
* File uploads to the server or an Amazon S3-compatible backend - Unlockable hints
* Limit challenge attempts & hide challenges - File uploads to the server or an Amazon S3-compatible backend
* Automatic bruteforce protection - Limit challenge attempts & hide challenges
* Individual and Team based competitions - Automatic bruteforce protection
* Have users play on their own or form teams to play together - Individual and Team based competitions
* Scoreboard with automatic tie resolution - Have users play on their own or form teams to play together
* Hide Scores from the public - Scoreboard with automatic tie resolution
* Freeze Scores at a specific time - Hide Scores from the public
* Scoregraphs comparing the top 10 teams and team progress graphs - Freeze Scores at a specific time
* Markdown content management system - Scoregraphs comparing the top 10 teams and team progress graphs
* SMTP + Mailgun email support - Markdown content management system
* Email confirmation support - SMTP + Mailgun email support
* Forgot password support - Email confirmation support
* Automatic competition starting and ending - Forgot password support
* Team management, hiding, and banning - Automatic competition starting and ending
* Customize everything using the [plugin](https://github.com/CTFd/CTFd/wiki/Plugins) and [theme](https://github.com/CTFd/CTFd/tree/master/CTFd/themes) interfaces - Team management, hiding, and banning
* Importing and Exporting of CTF data for archival - Customize everything using the [plugin](https://github.com/CTFd/CTFd/wiki/Plugins) and [theme](https://github.com/CTFd/CTFd/tree/master/CTFd/themes) interfaces
* And a lot more... - Importing and Exporting of CTF data for archival
- And a lot more...
## Install ## Install
1. Install dependencies: `pip install -r requirements.txt`
1. You can also use the `prepare.sh` script to install system dependencies using apt. 1. Install dependencies: `pip install -r requirements.txt`
2. Modify [CTFd/config.py](https://github.com/CTFd/CTFd/blob/master/CTFd/config.py) to your liking. 1. You can also use the `prepare.sh` script to install system dependencies using apt.
3. Use `flask run` in a terminal to drop into debug mode. 2. Modify [CTFd/config.py](https://github.com/CTFd/CTFd/blob/master/CTFd/config.py) to your liking.
3. Use `flask run` in a terminal to drop into debug mode.
You can use the auto-generated Docker images with the following command: You can use the auto-generated Docker images with the following command:
@@ -54,17 +56,21 @@ Or you can use Docker Compose with the following command from the source reposit
Check out the [wiki](https://github.com/CTFd/CTFd/wiki) for [deployment options](https://github.com/CTFd/CTFd/wiki/Basic-Deployment) and the [Getting Started](https://github.com/CTFd/CTFd/wiki/Getting-Started) guide Check out the [wiki](https://github.com/CTFd/CTFd/wiki) for [deployment options](https://github.com/CTFd/CTFd/wiki/Basic-Deployment) and the [Getting Started](https://github.com/CTFd/CTFd/wiki/Getting-Started) guide
## Live Demo ## Live Demo
https://demo.ctfd.io/ https://demo.ctfd.io/
## Support ## Support
To get basic support, you can join the [MajorLeagueCyber Community](https://community.majorleaguecyber.org/): [![MajorLeagueCyber Discourse](https://img.shields.io/discourse/status?server=https%3A%2F%2Fcommunity.majorleaguecyber.org%2F)](https://community.majorleaguecyber.org/) To get basic support, you can join the [MajorLeagueCyber Community](https://community.majorleaguecyber.org/): [![MajorLeagueCyber Discourse](https://img.shields.io/discourse/status?server=https%3A%2F%2Fcommunity.majorleaguecyber.org%2F)](https://community.majorleaguecyber.org/)
If you prefer commercial support or have a special project, feel free to [contact us](https://ctfd.io/contact/). If you prefer commercial support or have a special project, feel free to [contact us](https://ctfd.io/contact/).
## Managed Hosting ## Managed Hosting
Looking to use CTFd but don't want to deal with managing infrastructure? Check out [the CTFd website](https://ctfd.io/) for managed CTFd deployments. Looking to use CTFd but don't want to deal with managing infrastructure? Check out [the CTFd website](https://ctfd.io/) for managed CTFd deployments.
## MajorLeagueCyber ## MajorLeagueCyber
CTFd is heavily integrated with [MajorLeagueCyber](https://majorleaguecyber.org/). MajorLeagueCyber (MLC) is a CTF stats tracker that provides event scheduling, team tracking, and single sign on for events. CTFd is heavily integrated with [MajorLeagueCyber](https://majorleaguecyber.org/). MajorLeagueCyber (MLC) is a CTF stats tracker that provides event scheduling, team tracking, and single sign on for events.
By registering your CTF event with MajorLeagueCyber users can automatically login, track their individual and team scores, submit writeups, and get notifications of important events. By registering your CTF event with MajorLeagueCyber users can automatically login, track their individual and team scores, submit writeups, and get notifications of important events.
@@ -77,6 +83,7 @@ OAUTH_CLIENT_SECRET = None
``` ```
## Credits ## Credits
* Logo by [Laura Barbera](http://www.laurabb.com/)
* Theme by [Christopher Thompson](https://github.com/breadchris) - Logo by [Laura Barbera](http://www.laurabb.com/)
* Notification Sound by [Terrence Martin](https://soundcloud.com/tj-martin-composer) - Theme by [Christopher Thompson](https://github.com/breadchris)
- Notification Sound by [Terrence Martin](https://soundcloud.com/tj-martin-composer)