Skip to content

Commit

Permalink
refactor: introduce typos
Browse files Browse the repository at this point in the history
  • Loading branch information
azzamsa committed Jul 30, 2024
1 parent d956a5e commit a1ceeba
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 18 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:

- uses: taiki-e/install-action@just
- uses: taiki-e/install-action@dprint
- uses: taiki-e/install-action@v2
with:
tool: typos-cli

- name: Lint
# currently cli is not-maintained
Expand Down
3 changes: 3 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[files]
# cli is not maitained
extend-exclude = ["CHANGELOG.md", "cli/", "*.excalidraw"]
2 changes: 1 addition & 1 deletion agent/compose.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ services:
# using 127.0.0.1 or localhost won't make it work
# set it to RESTKNOT API IP
- RESTKNOT_KAFKA_BROKERS=10.0.0.1:9092,10.0.0.2:9092,10.0.0.3:9092
# topic to suscribe
# topic to subscribe
- RESTKNOT_KAFKA_TOPIC=domaindata
# consumer group id
- RESTKNOT_KAFKA_GROUP_ID=master1
Expand Down
2 changes: 1 addition & 1 deletion agent/dnsagent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def execute(message):
identifier=message.get("identifier"),
filters=message.get("filters"),
)
# `resp = ctl.receive_block()` receive nothing when the operation is succesfull
# `resp = ctl.receive_block()` receive nothing when the operation is successful
# calling it just a waste of resources
logger.info(f"Success: {cmd} {zone or ''} {item or ''} {data or ''}")
except libknot.control.KnotCtlError as knot_error:
Expand Down
2 changes: 1 addition & 1 deletion api/app/helpers/producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def kafka_admin():
except KeyError:
raise ValueError("Can't find brokers list in config")

# `AdmintClient` can't recive list of brokers
# `AdmintClient` can't receive list of brokers
conf = {"bootstrap.servers": brokers[0]}
admin_client = AdminClient(conf)
return admin_client
Expand Down
10 changes: 5 additions & 5 deletions api/app/helpers/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ def is_valid_ip(ip):
try:
ip_address(ip)
except ValueError:
raise ValueError("Bad IP Adrress")
raise ValueError("Bad IP Address")


def is_valid_email(email):
"""Check if it's a valid email address."""
match = re.match(RE_EMAIL, email)
if match is None:
raise ValueError("Bad Email Adrress")
raise ValueError("Bad Email Address")


def is_valid_mx(mx_rdata):
Expand Down Expand Up @@ -137,15 +137,15 @@ def is_valid_owner(owner):
- owner can't contains parens ("()")
"""

def check_hypen(label):
def check_hyphen(label):
if any((label.endswith("."), label.endswith("-"), label.startswith("-"))):
raise ValueError("Bad OWNER")

check_hypen(owner)
check_hyphen(owner)

if "." in owner:
for label in owner.split("."):
check_hypen(label)
check_hyphen(label)

if len(owner) > 255:
raise ValueError("Bad OWNER")
Expand Down
6 changes: 3 additions & 3 deletions api/app/models/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ def insert(table, data=None):
rows.append(row)
rows_value.append(str(data[row]))

str_placeholer = ["%s"] * len(rows)
str_placeholder = ["%s"] * len(rows)

try:
rows = ",".join(rows)
str_placeholer = ",".join(str_placeholer)
str_placeholder = ",".join(str_placeholder)

query = f'INSERT INTO "{table}" ({rows}) VALUES ({str_placeholer}) RETURNING *'
query = f'INSERT INTO "{table}" ({rows}) VALUES ({str_placeholder}) RETURNING *'
cursor.prepare(query)
cursor.execute((tuple(rows_value)))
except (Exception, psycopg2.DatabaseError) as error:
Expand Down
4 changes: 2 additions & 2 deletions api/compose.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ services:
- APP_HOST=0.0.0.0 # default 0.0.0.0
- APP_PORT=5000 # default 8000

- DB_NAME=knotdb # don't add whitespace beetween =
- DB_NAME=knotdb # don't add whitespace between =
- DB_HOST=roach
- DB_PORT=26257
- DB_USER=root
- DB_SSL=disable

# topic to suscribe
# topic to subscribe
- RESTKNOT_KAFKA_TOPIC=domaindata

# don't add quote, otherwise it will not work
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/playbooks/ansible.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[defaults]
inventory = ./hosts.yml
host_key_checking = False # don't promt for ssh 'un'-known hosts
host_key_checking = False # don't prompt for ssh 'un'-known hosts
2 changes: 1 addition & 1 deletion docs/examples/playbooks/initial-setups.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# tested againts CentOS 7.5
# tested against CentOS 7.5

---
- hosts: all
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/playbooks/setup-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
- "schema.sql"

- name: Check if docker exists
# changing PATH is dangerous. it's bettter to
# changing PATH is dangerous. it's better to
# just use a full path
command: ~/.local/bin/docker-compose -v
args:
Expand Down
2 changes: 1 addition & 1 deletion docs/howto.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ To make sure that the records were created on the Knot side. Use ``dig`` or ``kd
$ kdig @localhost example.com SOA +short
Add/Edit/Remove spesific Record
Add/Edit/Remove specific Record
-------------------------------

To add/edit/remove specific record you can use :code:`/record/add`,
Expand Down
2 changes: 1 addition & 1 deletion docs/knotintro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ These are common command operation to give you insight how to do things:
$ # use +tcp if your ISP provider annoys you
$ kdig @localhost niu.com SOA +short +tcp
$ # start everyting from scratch
$ # start everything from scratch
$ # stop knotd and knot-agent
# rm -rf * /var/lib/knot # remove all knot db
# rm -rf * /etc/knot # most of the time, it doesn't needed
Expand Down
2 changes: 2 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ fmt-check:

# Lint the codebase.
lint:
# Run `typos --write-changes` to fix the mistakes
typos

0 comments on commit a1ceeba

Please sign in to comment.