Skip to content

Commit ed3b10e

Browse files
authored
[DEVOPS-1591] Install pre-commit, and fix all files (#12)
Install pre-commit, and fix all files
1 parent bbc288b commit ed3b10e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+74
-24
lines changed

.github/workflows/build.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,24 @@ jobs:
2828
VALIDATE_BASH_EXEC: true
2929
VALIDATE_DOCKERFILE_HADOLINT: true
3030
VALIDATE_YAML: true
31+
32+
run-hooks:
33+
name: Run pre-commit hooks
34+
runs-on: ubuntu-22.04
35+
36+
steps:
37+
- name: Checkout Repo
38+
uses: actions/checkout@v3
39+
40+
- name: Set Up Python
41+
uses: actions/setup-python@v4
42+
with:
43+
python-version: 3.x
44+
45+
- name: Install pre-commit
46+
run: |
47+
pip install --upgrade pip
48+
pip install --upgrade pre-commit
49+
50+
- name: Run pre-commit hooks ✅
51+
run: pre-commit run --all-files --hook-stage manual

.pre-commit-config.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.2.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-added-large-files
8+
- id: check-shebang-scripts-are-executable
9+
- id: check-executables-have-shebangs
10+
11+
- repo: https://github.com/shellcheck-py/shellcheck-py
12+
rev: v0.9.0.5
13+
hooks:
14+
- id: shellcheck
15+
args: ["-x"]
16+
17+
- repo: https://github.com/hadolint/hadolint.git
18+
rev: v2.12.1-beta
19+
hooks:
20+
- id: hadolint-docker
21+
entry: hadolint/hadolint:v2.12.1-beta hadolint
22+
23+
# Lint: YAML
24+
- repo: https://github.com/adrienverge/yamllint.git
25+
rev: v1.32.0
26+
hooks:
27+
- id: yamllint
28+
args: [ "-d {extends: relaxed, rules: {line-length: disable}}", "-s" ]
29+
files: \.(yaml|yml)$

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion

CONTRIBUTING.md

Lines changed: 7 additions & 7 deletions

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2626
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2727
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2828
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

R/Aptfile

100755100644
File mode changed.

R/base/4.3.0/Dockerfile

100755100644
File mode changed.

R/noteable/.Rprofile

100755100644
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ library(repr)
33
library(reticulate)
44

55
prepare_dex_content <- function(df) {
6-
#'
6+
#'
77
#' Create schema and data structure for data frame to be rendered by DEX
8-
#'
8+
#'
99

1010
# create a schema for a dataframe, which DEX uses to determine column dtypes.
11-
# R data frames don't have this functionality, so we have to use reticulate
11+
# R data frames don't have this functionality, so we have to use reticulate
1212
# to call into the python pandas library
1313
pandas <- import("pandas")
1414

@@ -41,9 +41,9 @@ prepare_dex_content <- function(df) {
4141
}
4242

4343
prepare_dex_metadata <- function(df) {
44-
#'
44+
#'
4545
#' Create metadata for data frame to be rendered by DEX
46-
#'
46+
#'
4747
list(
4848
default_index_used=TRUE,
4949
dataframe_info = list(
@@ -72,11 +72,11 @@ repr_dex <- function(obj, ...) {
7272
enable_dex_formatter <- function() {
7373
# Add custom display formatter to newly added mimetype
7474
IRkernel:::replace_in_package('repr', 'mime2repr', c(repr::mime2repr, list(`application/vnd.dataresource+json` = repr_dex)))
75-
75+
7676
# Add dataresource mimetype to list of recognized mimetypes
7777
mimetypes <- c(getOption('jupyter.display_mimetypes'), "application/vnd.dataresource+json")
7878
options(jupyter.display_mimetypes = mimetypes)
79-
79+
8080
# Register custom formatter for matrix and data.frame
8181
registerS3method("repr_html", "matrix", repr_dex)
8282
registerS3method("repr_html", "data.frame", repr_dex)
@@ -85,11 +85,11 @@ enable_dex_formatter <- function() {
8585
disable_dex_formatter <- function() {
8686
# Remove custom display formatter
8787
IRkernel:::replace_in_package('repr', 'mime2repr', repr::mime2repr)
88-
88+
8989
# Remove dataresource mimetype from list of recognized mimetypes
9090
mimetypes <- setdiff(getOption('jupyter.display_mimetypes'), "application/vnd.dataresource+json")
9191
options(jupyter.display_mimetypes = mimetypes)
92-
92+
9393
# Reset the formatter for matrix and data.frame to the default
9494
registerS3method("repr_html", "matrix", repr:::repr_html.matrix)
9595
registerS3method("repr_html", "data.frame", repr:::repr_html.data.frame)

R/noteable/requirements.R

100755100644
File mode changed.

python/Aptfile

100755100644
File mode changed.

0 commit comments

Comments
 (0)