Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add typos job and fix typos across the repo #1525

Merged
merged 3 commits into from
Mar 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ jobs:
- name: Ensure generated code is up to date
run: ./scripts/codegen.sh && git diff --exit-code

typos:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: typos-action
uses: crate-ci/[email protected]

test:
runs-on: ubuntu-latest
strategy:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ yarn run dev
yarn run dev-windows
```

Sometimes, you may want to run them seperately so you can use breakpoints to
Sometimes, you may want to run them separately so you can use breakpoints to
debug. Using VSCode, this is trivial.

To start the server: `Debug > Select "Launch Program" > Start`
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/LogInForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -304,15 +304,15 @@
password: password.value,
});
if (resp.data.success) {
console.log("Registeration success");
console.log("Registration success");

Check warning on line 307 in client/src/components/LogInForm.vue

View check run for this annotation

Codecov / codecov/patch

client/src/components/LogInForm.vue#L307

Added line #L307 was not covered by tests
store.commit("LOGIN", resp.data.user);
emit("shouldClose");
email.value = "";
username.value = "";
password.value = "";
password2.value = "";
} else {
console.log("Registeration failed");
console.log("Registration failed");

Check warning on line 315 in client/src/components/LogInForm.vue

View check run for this annotation

Codecov / codecov/patch

client/src/components/LogInForm.vue#L315

Added line #L315 was not covered by tests
registerFailureMessage.value = t(
"login-form.errors.something-weird-happened"
) as string;
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/RoomSettingsForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
});

async function loadRoomSettings() {
// we have to make an API request becuase visibility is not sent in sync messages.
// we have to make an API request because visibility is not sent in sync messages.

Check warning on line 192 in client/src/components/RoomSettingsForm.vue

View check run for this annotation

Codecov / codecov/patch

client/src/components/RoomSettingsForm.vue#L192

Added line #L192 was not covered by tests
isLoadingRoomSettings.value = true;
try {
const res = await API.get<OttApiResponseGetRoom>(`/room/${store.state.room.name}`);
Expand Down
2 changes: 1 addition & 1 deletion client/src/views/Privacy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<p>
General site usage, like creating a room, adding videos, etc., are logged to monitor and
debug performace. Logs are not kept for more than a week. Logged events are not
debug performance. Logs are not kept for more than a week. Logged events are not

Check warning on line 16 in client/src/views/Privacy.vue

View check run for this annotation

Codecov / codecov/patch

client/src/views/Privacy.vue#L16

Added line #L16 was not covered by tests
associated with your account or session.
</p>

Expand Down
2 changes: 1 addition & 1 deletion client/src/views/Room.vue
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@
}

// Indicates that starting playback is blocked by the browser. This usually means that the user needs
// to interact with the page before playback can start. This is because browers block autoplaying videos.
// to interact with the page before playback can start. This is because browsers block autoplaying videos.

Check warning on line 450 in client/src/views/Room.vue

View check run for this annotation

Codecov / codecov/patch

client/src/views/Room.vue#L450

Added line #L450 was not covered by tests
const mediaPlaybackBlocked = ref(false);

async function applyIsPlaying(playing: boolean): Promise<void> {
Expand Down
4 changes: 2 additions & 2 deletions common/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ export class Grants {
masks: RoleGrants = new Map();

/**
* @param {Object|undefined} grants Opional object that maps roles to grant masks.
* @param {Object|undefined} grants Optional object that maps roles to grant masks.
*/
constructor(
grants: Grants | RoleGrants | OldRoleGrants | [Role, GrantMask][] | undefined = undefined
Expand All @@ -250,7 +250,7 @@ export class Grants {

/**
* Clears all grant masks and replaces them with `grants`.
* @param grants Opional object that maps roles to grant masks.
* @param grants Optional object that maps roles to grant masks.
*/
setAllGrants(grants: RoleGrants | Grants | OldRoleGrants | [Role, GrantMask][]): void {
this.masks = new Map();
Expand Down
2 changes: 1 addition & 1 deletion common/tests/unit/permissions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ describe("Permission System", () => {
);
});

it("should guarentee that using numbers for roles works for Grants", () => {
it("should guarantee that using numbers for roles works for Grants", () => {
const grants = new Grants({ "0": 4095 });
expect(grants.getMask(0)).toEqual(4095);
});
Expand Down
4 changes: 2 additions & 2 deletions common/tests/unit/serialize.spec-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
expectTypeOf<ConvertToJsonSafe<bigint>>().toEqualTypeOf<string>();
});

it("should not convert other primative types", () => {
it("should not convert other primitive types", () => {

Check warning on line 13 in common/tests/unit/serialize.spec-d.ts

View check run for this annotation

Codecov / codecov/patch

common/tests/unit/serialize.spec-d.ts#L13

Added line #L13 was not covered by tests
expectTypeOf<ConvertToJsonSafe<number>>().toEqualTypeOf<number>();
expectTypeOf<ConvertToJsonSafe<string>>().toEqualTypeOf<string>();
expectTypeOf<ConvertToJsonSafe<boolean>>().toEqualTypeOf<boolean>();
expectTypeOf<ConvertToJsonSafe<null>>().toEqualTypeOf<null>();
});

it("should not convert arrays of primatives", () => {
it("should not convert arrays of primitives", () => {

Check warning on line 20 in common/tests/unit/serialize.spec-d.ts

View check run for this annotation

Codecov / codecov/patch

common/tests/unit/serialize.spec-d.ts#L20

Added line #L20 was not covered by tests
expectTypeOf<ConvertToJsonSafe<number[]>>().toEqualTypeOf<number[]>();
});

Expand Down
2 changes: 1 addition & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ cp env/example.toml env/production.toml
1. Open `env/production.toml` and put your youtube API key in.

2. To build the image locally using the prod image make sure you are in the project root `/opentogethertube`
before runing the command below.
before running the command below.

```bash
docker-compose -f docker/docker-compose.yml up -d
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ There are 3 major components to the application:

## Rooms

In order to accomodate horizontal scaling, there is a `clientmanager` and a `roommanager`. The `clientmanager` manages all websocket connections, and relays all messages for rooms to the `roommanager`. The `roommanger` manages rooms, and relies on the Balancer to ensure that the same room doesn't get loaded twice on different Monoliths. Rooms manage their own state.
In order to accommodate horizontal scaling, there is a `clientmanager` and a `roommanager`. The `clientmanager` manages all websocket connections, and relays all messages for rooms to the `roommanager`. The `roommanger` manages rooms, and relies on the Balancer to ensure that the same room doesn't get loaded twice on different Monoliths. Rooms manage their own state.

```mermaid
graph LR
Expand Down
2 changes: 1 addition & 1 deletion packages/ott-vis-panel/src/components/TreeDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ const TreeDisplay: React.FC<TreeDisplayProps> = ({ systemState, width, height })
});

// create nodes for all the balancers evenly spaced along the full height of the monolith trees
// but also guarenteeing that they don't overlap with each other or the monoliths with some padding
// but also guaranteeing that they don't overlap with each other or the monoliths with some padding
const fullHeight = Math.max(...monolithTreeYs);
const lerp = d3.interpolateNumber(0, fullHeight);
const lerpincr = 1 / (systemState.length - 1);
Expand Down
2 changes: 1 addition & 1 deletion server/api/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
success: false,
error: {
name: "Unknown",
message: "An unknown error occured. Try again later.",
message: "An unknown error occurred. Try again later.",

Check warning on line 121 in server/api/data.ts

View check run for this annotation

Codecov / codecov/patch

server/api/data.ts#L121

Added line #L121 was not covered by tests
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion server/api/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@
success: false,
error: {
name: "Unknown",
message: "An unknown error occured. Try again later.",
message: "An unknown error occurred. Try again later.",

Check warning on line 486 in server/api/room.ts

View check run for this annotation

Codecov / codecov/patch

server/api/room.ts#L486

Added line #L486 was not covered by tests
},
});
}
Expand Down
4 changes: 2 additions & 2 deletions server/exceptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
let msg = "";
let parsed = new URL(url);
if (parsed.pathname && /\/*\.([a-z0-9])$/i.exec(parsed.pathname.split("?")[0])) {
msg = `If this is a direct link to a video file, please open a "service support request" issue on github, so we can see if this file format works. Otherwise, "${url}" is not a valid URL for any suppported service.`;
msg = `If this is a direct link to a video file, please open a "service support request" issue on github, so we can see if this file format works. Otherwise, "${url}" is not a valid URL for any supported service.`;

Check warning on line 11 in server/exceptions.ts

View check run for this annotation

Codecov / codecov/patch

server/exceptions.ts#L11

Added line #L11 was not covered by tests
} else {
msg = `"${url}" is not a valid URL for any suppported service.`;
msg = `"${url}" is not a valid URL for any supported service.`;

Check warning on line 13 in server/exceptions.ts

View check run for this annotation

Codecov / codecov/patch

server/exceptions.ts#L13

Added line #L13 was not covered by tests
}
super(msg);
this.name = "UnsupportedServiceException";
Expand Down
2 changes: 1 addition & 1 deletion server/infoextractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
getServiceAdapter(service: string): ServiceAdapter {
const adapter = adapters.find(adapter => adapter.serviceId === service);
if (!adapter) {
throw new OttException(`Unkonwn service: ${service}`);
throw new OttException(`Unknown service: ${service}`);

Check warning on line 170 in server/infoextractor.ts

View check run for this annotation

Codecov / codecov/patch

server/infoextractor.ts#L170

Added line #L170 was not covered by tests
}
return adapter;
},
Expand Down
2 changes: 1 addition & 1 deletion server/redisclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ async function collectRedisMetrics() {
log.silly(`Collected ${countMetricsCollected} redis metrics, skipped ${countMetricsSkipped}`);
}

const guageRedisDbsize = new Gauge({
const gaugeRedisDbsize = new Gauge({
name: "redis_keys_count",
help: "The number of keys in the database",
async collect() {
Expand Down
2 changes: 1 addition & 1 deletion server/roommanager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ const gaugeRoomCount = new Gauge({
},
});

const guageUsersInRooms = new Gauge({
const gaugeUsersInRooms = new Gauge({
name: "ott_users_in_rooms",
help: "The number of users that the room manager thinks are in rooms.",
collect() {
Expand Down
4 changes: 2 additions & 2 deletions server/storage.metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
ORDER BY n_live_tup DESC;`;

export function setupPostgresMetricsCollection(sequelize: Sequelize) {
const guagePostgresRowCount = new Gauge({
const gaugePostgresRowCount = new Gauge({

Check warning on line 26 in server/storage.metrics.ts

View check run for this annotation

Codecov / codecov/patch

server/storage.metrics.ts#L26

Added line #L26 was not covered by tests
name: "postgres_db_row_count",
help: "Number of rows in a table in the database",
labelNames: ["table"],
Expand Down Expand Up @@ -54,7 +54,7 @@
},
});

const guagePostgresTableOps = new Gauge({
const gaugePostgresTableOps = new Gauge({

Check warning on line 57 in server/storage.metrics.ts

View check run for this annotation

Codecov / codecov/patch

server/storage.metrics.ts#L57

Added line #L57 was not covered by tests
name: "postgres_table_ops",
help: "Number of table operations in the database",
labelNames: ["table", "operation"],
Expand Down
2 changes: 1 addition & 1 deletion server/tests/unit/api/announcement.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ describe("Announcements API", () => {
expect(publishSpy).not.toHaveBeenCalled();
});

it("should fail if an unknown error occurrs", async () => {
it("should fail if an unknown error occurs", async () => {
publishSpy = publishSpy.mockImplementation(() => {
throw new Error("fake error");
});
Expand Down
6 changes: 3 additions & 3 deletions server/usermanager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
oldUsername = req.user.username;
req.user.username = req.body.username;
try {
// HACK: the unique constrait on the model is fucking broken
// HACK: the unique constraint on the model is fucking broken
if (await isUsernameTaken(req.body.username)) {
throw new UsernameTakenError();
}
Expand Down Expand Up @@ -607,7 +607,7 @@
// eslint-disable-next-line array-bracket-newline
const hash = await pwd.hash(Buffer.concat([salt, Buffer.from(password)]));

// HACK: the unique constrait on the model is fucking broken
// HACK: the unique constraint on the model is fucking broken
if (await isUsernameTaken(username)) {
throw new UsernameTakenError();
}
Expand Down Expand Up @@ -899,7 +899,7 @@
success: false,
error: {
name: "Unknown",
message: "An unknown error occured. Try again later.",
message: "An unknown error occurred. Try again later.",

Check warning on line 902 in server/usermanager.ts

View check run for this annotation

Codecov / codecov/patch

server/usermanager.ts#L902

Added line #L902 was not covered by tests
},
});
}
Expand Down
19 changes: 19 additions & 0 deletions typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[default]
locale = "en-us"

[default.extend-words]
guage = "gauge"
AVOD = "AVOD"
ser = "ser"
seeked = "seeked"
# google drive misspelled this in their API
aknowledge = "aknowledge"

[files]
extend-exclude = [
"server/tests/unit/fixtures",
"server/tests/unit/services/youtube.spec.ts",
"server/tests/unit/services/dailymotion.spec.ts",
"client/src/locales",
"!client/src/locales/en.ts",
]
Loading