Skip to content

Commit

Permalink
[chore] Host style guides in examples repo (#95)
Browse files Browse the repository at this point in the history
- Consolidate Ruby style guides
- Consolidate Python style guides
- Consolidate PHP style guides
- Consolidate .NET style guides
- Consolidate Java style guides
- Consolidate Go style guides
- Consolidate Node style guides
- Add lint step to CI for Java
- Remove duplicate CheckStyle check for Java
- Update Makefile steps to copy style guides to path (via symlink) when "installing"
- Ignore root-level style guides
- Update Node dependencies to match CL as much as needed
- Pass folder scope in PHP lint and fix commands
- Some Python lints
- Fix format-ruby Make step
  • Loading branch information
nwithan8 authored Jun 12, 2023
1 parent 22cbdf5 commit f3ddc31
Show file tree
Hide file tree
Showing 27 changed files with 1,860 additions and 2,148 deletions.
23 changes: 0 additions & 23 deletions .eslintrc

This file was deleted.

9 changes: 2 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,8 @@ jobs:
uses: actions/checkout@v3
- name: Install Java dependencies
run: make install-java
- name: Run CheckStyle checks
uses: nikitasavinov/[email protected]
with:
level: error
fail_on_error: true
checkstyle_config: easypost_java_style.xml
tool_name: 'style_enforcer'
- name: Lint project
run: make lint-java
node:
runs-on: ubuntu-latest
steps:
Expand Down
19 changes: 17 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,25 @@ __pycache__
.idea
.vscode
*.egg-info
/checkstyle.jar
/easypost_java_style.xml
/vendor
bin
node_modules
target
venv
/.editorconfig
/.eslintrc
/.flake8
/.golangci.yml
/.prettierignore
/.prettierrc.yml
/.rubocop.yml
/checkstyle.jar
/easycop.yml
/easypost_java_style.xml
/layout_rules.xml
/phpcs.xml
/pyproject.toml
/style_suppressions.xml
/.dummy
/.babelrc
/.eslintignore
8 changes: 0 additions & 8 deletions .prettierignore

This file was deleted.

12 changes: 9 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,33 +36,39 @@ install: | install-csharp install-go install-java install-node install-php insta

## install-csharp - install C# dependencies
install-csharp:
sh ./symlink_directory_files.sh style_guides/csharp .
dotnet tool install -g dotnet-format || exit 0

## install-go - Install and vendor Go dependencies
install-go:
sh ./symlink_directory_files.sh style_guides/golang .
go mod vendor

## install-java - installs Java dependencies
install-java:
mvn dependency:resolve
sh ./symlink_directory_files.sh style_guides/java .
curl -LJs https://github.com/checkstyle/checkstyle/releases/download/checkstyle-10.3.1/checkstyle-10.3.1-all.jar -o checkstyle.jar
curl -LJs https://raw.githubusercontent.com/EasyPost/easypost-java/master/easypost_java_style.xml -o easypost_java_style.xml
mvn dependency:resolve

## install-node - installs Node dependencies
install-node:
sh ./symlink_directory_files.sh style_guides/node .
npm install

## install-php - installs PHP dependencies
install-php:
sh ./symlink_directory_files.sh style_guides/php .
composer install

## install-python - install Python dependencies
install-python:
sh ./symlink_directory_files.sh style_guides/python .
$(PYTHON_BINARY) -m venv $(PYTHON_VIRTUAL_ENV)
$(PYTHON_VIRTUAL_BIN)/pip install -e ."[dev]"

## install-ruby - installs Ruby dependencies
install-ruby:
sh ./symlink_directory_files.sh style_guides/ruby .
bundle install

## lint - lints the entire project
Expand Down Expand Up @@ -139,7 +145,7 @@ format-python:

## format-ruby - formats Ruby files
format-ruby:
rubocop -A
bundle exec rubocop -a

## format-shell - formats shell files
format-shell:
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"squizlabs/php_codesniffer": "^3.7"
},
"scripts": {
"fix": "./bin/phpcbf",
"lint": "./bin/phpcs"
"fix": "./bin/phpcbf official/docs/php",
"lint": "./bin/phpcs official/docs/php"
},
"config": {
"bin-dir": "bin"
Expand Down
4 changes: 1 addition & 3 deletions official/guides/rate-limiting/retry_and_backoff.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import requests
from urllib3.util.retry import (
Retry,
)
from urllib3.util.retry import Retry


retry_strategy = Retry(
Expand Down
8 changes: 2 additions & 6 deletions official/guides/sms-tracking-tutorial/step2a.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import easypost
from flask import (
Flask,
)
from twilio.rest import (
TwilioRestClient,
)
from flask import Flask
from twilio.rest import TwilioRestClient


app = Flask(__name__)
Expand Down
Loading

0 comments on commit f3ddc31

Please sign in to comment.