Skip to content

Commit

Permalink
chore: add cspell (#1390)
Browse files Browse the repository at this point in the history
Co-authored-by: Felix Angelov <felangelov@gmail.com>
  • Loading branch information
eseidel and felangel authored Aug 6, 2024
1 parent e5ee953 commit f3e4b38
Show file tree
Hide file tree
Showing 16 changed files with 77 additions and 28 deletions.
44 changes: 44 additions & 0 deletions cspell.config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
$schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json
version: "0.2"
ignorePaths:
- "*_bundle.dart"
words:
- APPDATA
- LOCALAPPDATA
- mocktail
- buildroot
- endtemplate
- writeln
- recase
- ints
- combinators
- tearoffs
- pubspec
- unawaited
- interps
- livestream
- angelov
- podfile
- PANA
- recompile
- dartaotruntime
- unbundle
- xlink
- struct
- brickhub
- felangel
- Verdana
- vscodeignore
- nosources
- recompiles
- unbundling
- sublist
- Flutterly
- antiprioritize # This might be an api mistake?
- Yyna
- dylib
- libc
- calloc
- nullptr
- xmit
- keypress
6 changes: 3 additions & 3 deletions extensions/vscode/src/commands/make-brick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,12 @@ const promptForList = async (
title: string,
separator?: string,
): Promise<string | undefined> => {
const delimeter = separator ?? ",";
const delimiter = separator ?? ",";
const input = await vscode.window.showInputBox({
prompt: title,
placeHolder: `Enter a list separated by "${delimeter}"`,
placeHolder: `Enter a list separated by "${delimiter}"`,
});
const results = input?.split(delimeter);
const results = input?.split(delimiter);
const selection = results?.map((r) => r.trimStart());
return JSON.stringify(JSON.stringify(selection));
};
Expand Down
4 changes: 2 additions & 2 deletions packages/mason/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@

# 0.1.0-dev.16

- fix: lamdba shorthand syntax interop
- fix: lambda shorthand syntax interop

# 0.1.0-dev.15

Expand Down Expand Up @@ -699,7 +699,7 @@ vars:
- feat: add `lowerCase` and `upperCase` lambdas
- fix: support non utf8 encoded files
- fix: switch templating engine to be lenient by default
- refactor: avoid templating content with no delimeters
- refactor: avoid templating content with no delimiters

# 0.0.1-dev.17

Expand Down
4 changes: 2 additions & 2 deletions packages/mason/lib/src/generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ bool get _isAotCompiled => bool.fromEnvironment('dart.vm.product');
final _descriptorPool = Pool(32);
final _partialRegExp = RegExp(r'\{\{~\s(.+)\s\}\}');
final _fileRegExp = RegExp(r'{{%\s?([a-zA-Z]+)\s?%}}');
final _delimeterRegExp = RegExp('{{([^;,=]*?)}}');
final _delimiterRegExp = RegExp('{{([^;,=]*?)}}');
final _loopKeyRegExp = RegExp('{{#(.*?)}}');
final _loopValueReplaceRegExp = RegExp('({{{.*?}}})');
final _lambdas = RegExp(
Expand Down Expand Up @@ -512,7 +512,7 @@ class TemplateFile {
) {
try {
final decoded = utf8.decode(content);
if (!decoded.contains(_delimeterRegExp)) return content;
if (!decoded.contains(_delimiterRegExp)) return content;
final rendered = decoded.render(vars, partials);
return utf8.encode(rendered);
} on Exception {
Expand Down
2 changes: 1 addition & 1 deletion packages/mason/lib/src/path.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:path/path.dart' as p;

/// Canonicalizes [path].
///
/// This function implements the behaviour of `canonicalize` from
/// This function implements the behavior of `canonicalize` from
/// `package:path`.
/// However, it does not change the ASCII case of the path.
/// See https://github.com/dart-lang/path/issues/102.
Expand Down
2 changes: 1 addition & 1 deletion packages/mason/lib/src/yaml_encode.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// Yaml Utiilities
/// Yaml Utilities
class Yaml {
/// Encodes a [Map<String, dynamic>] as `yaml` similar to `json.encode`.
static String encode(Map<dynamic, dynamic> json, [int nestingLevel = 0]) {
Expand Down
2 changes: 1 addition & 1 deletion packages/mason_api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ A Dart API client used by [package:mason_cli](https://github.com/felangel/mason)
import 'package:mason_api/mason_api.dart';
const email = 'my@email.com';
const password = 't0pS3cret!';
const password = 'top-secret!';
Future<void> main() async {
final masonApi = MasonApi();
Expand Down
2 changes: 1 addition & 1 deletion packages/mason_api/example/main.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:mason_api/mason_api.dart';

const email = 'my@email.com';
const password = 't0pS3cret!';
const password = 't0pS3cret!'; // cspell:disable-line

Future<void> main() async {
final masonApi = MasonApi();
Expand Down
2 changes: 1 addition & 1 deletion packages/mason_api/test/src/jwt_decode_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:mason_api/src/jwt_decode.dart';
import 'package:test/test.dart';

void main() {
const token =
const token = // cspell:disable-next-line
'''eyJhbGciOiJSUzI1NiIsImN0eSI6IkpXVCJ9.eyJlbWFpbCI6InRlc3RAZW1haWwuY29tIn0.pD47BhF3MBLyIpfsgWCzP9twzC1HJxGukpcR36DqT6yfiOMHTLcjDbCjRLAnklWEHiT0BQTKTfhs8IousU90Fm5bVKObudfKu8pP5iZZ6Ls4ohDjTrXky9j3eZpZjwv8CnttBVgRfMJG-7YASTFRYFcOLUpnb4Zm5R6QdoCDUYg''';
group('Jwt', () {
group('decodeClaims', () {
Expand Down
8 changes: 4 additions & 4 deletions packages/mason_api/test/src/mason_api_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import 'package:test/test.dart';

class _MockHttpClient extends Mock implements http.Client {}

const token =
const token = // cspell:disable-next-line
'''eyJhbGciOiJSUzI1NiIsImN0eSI6IkpXVCJ9.eyJlbWFpbCI6InRlc3RAZW1haWwuY29tIiwiZW1haWxfdmVyaWZpZWQiOmZhbHNlfQ.SaCs1BJ2Oib4TkUeR6p1uh_XnWjJnJpm-dZkL8Whsc_g-NrDKeHhkuVa8fNIbfLtdVeXjVSSi_ZjQDAJho039HSrrdhQAgrRY04cJ6IZCF1HKvJeWDcIihPdl2Zl_V5u9xBxU3ImfGpJ-0O0vCpKHIuDwZsmfN3h_CkDv3SK7lA''';
const authority = 'registry.brickhub.dev';
const credentialsFileName = 'mason-credentials.json';
const email = 'test@email.com';
const password = 'T0pS3cret!';
const password = 'T0pS3cret!'; // cspell:disable-line

class TestMasonApiException extends MasonApiException {
const TestMasonApiException({required super.message, super.details});
Expand Down Expand Up @@ -274,7 +274,7 @@ void main() {
).thenAnswer(
(_) async => http.Response(
json.encode({
'access_token':
'access_token': // cspell:disable-next-line
'''eyJhbGciOiJSUzI1NiIsImN0eSI6IkpXVCJ9.eyJmb28iOiJiYXIifQ.LaR0JfOiDrS1AuABC38kzxpSjRLJ_OtfOkZ8hL6I1GPya-cJYwsmqhi5eMBwEbpYHcJhguG5l56XM6dW8xjdK7JbUN6_53gHBosSnL-Ccf29oW71Ado9sxO17YFQyihyMofJ_v78BPVy2H5O10hNjRn_M0JnnAe0Fvd2VrInlIE''',
'refresh_token': '__refresh_token__',
'expires_in': '3600',
Expand Down Expand Up @@ -526,7 +526,7 @@ void main() {
).thenAnswer(
(_) async => http.Response(
json.encode({
'access_token':
'access_token': // cspell:disable-next-line
'''eyJhbGciOiJSUzI1NiIsImN0eSI6IkpXVCJ9.eyJmb28iOiJiYXIifQ.LaR0JfOiDrS1AuABC38kzxpSjRLJ_OtfOkZ8hL6I1GPya-cJYwsmqhi5eMBwEbpYHcJhguG5l56XM6dW8xjdK7JbUN6_53gHBosSnL-Ccf29oW71Ado9sxO17YFQyihyMofJ_v78BPVy2H5O10hNjRn_M0JnnAe0Fvd2VrInlIE''',
'refresh_token': '__refresh_token__',
'expires_in': '3600',
Expand Down
1 change: 1 addition & 0 deletions packages/mason_cli/test/commands/bundle_test.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// cspell:ignore SGkge3tuYW1lfX0h
import 'dart:convert';
import 'dart:io';

Expand Down
4 changes: 2 additions & 2 deletions packages/mason_cli/test/commands/login_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void main() {

test('exits with code 70 when MasonApiLoginFailure occurs', () async {
const email = 'test@email.com';
const password = 'T0pS3cret!';
const password = 'T0pS3cret!'; // cspell:disable-line
const message = 'oops something went wrong!';
when(
() => logger.prompt('email:', defaultValue: any(named: 'defaultValue')),
Expand Down Expand Up @@ -86,7 +86,7 @@ void main() {

test('exits with code 0 when logged in successfully', () async {
const email = 'test@email.com';
const password = 'T0pS3cret!';
const password = 'T0pS3cret!'; // cspell:disable-line
final user = _MockUser();
when(() => user.email).thenReturn(email);
when(
Expand Down
4 changes: 4 additions & 0 deletions packages/mason_logger/lib/src/ffi/unix_terminal.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// coverage:ignore-file
// ignore_for_file: public_member_api_docs, constant_identifier_names, camel_case_types, non_constant_identifier_names, lines_longer_than_80_chars

// cspell:words tcgetattr BRKINT ICRNL INPCK ISTRIP IXON lflag CSIZE
// cspell:words fildes termios ospeed ispeed tcflag ncss vtime vmin cflag
// cspell:words icanon isig iexten tcsanow tcsetattr FILENO iflag oflag OPOST

import 'dart:ffi';
import 'dart:io';

Expand Down
4 changes: 2 additions & 2 deletions packages/mason_logger/lib/src/io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ enum ControlCharacter {
/// Neg acknowledge
ctrlU,

/// Syncronous idel
/// Synchronous idle
ctrlV,

/// End of xmit block
Expand All @@ -83,7 +83,7 @@ enum ControlCharacter {
/// End of medium
ctrlY,

/// Substitue (suspend)
/// Substitute (suspend)
ctrlZ,

/// Left arrow
Expand Down
12 changes: 6 additions & 6 deletions packages/mason_logger/lib/src/mason_logger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ class Logger {
..echoMode = false
..lineMode = false;

final delimeter = '$separator ';
final delimiter = '$separator ';
var rawString = '';

_stdout.write('$message ');
Expand All @@ -228,7 +228,7 @@ class Logger {

if (isDeleteOrBackspaceKey) {
if (rawString.isNotEmpty) {
if (rawString.endsWith(delimeter)) {
if (rawString.endsWith(delimiter)) {
_stdout.write('\b\b\x1b[K');
rawString = rawString.substring(0, rawString.length - 2);
} else {
Expand All @@ -240,19 +240,19 @@ class Logger {
}

if (key.char == separator) {
_stdout.write(delimeter);
rawString += delimeter;
_stdout.write(delimiter);
rawString += delimiter;
} else {
_stdout.write(key.char);
rawString += key.char;
}
}

if (rawString.endsWith(delimeter)) {
if (rawString.endsWith(delimiter)) {
rawString = rawString.substring(0, rawString.length - 2);
}

final results = rawString.isEmpty ? <String>[] : rawString.split(delimeter);
final results = rawString.isEmpty ? <String>[] : rawString.split(delimiter);
const clearLine = '\u001b[2K\r';
_stdout.write(
'$clearLine$message ${styleDim.wrap(lightCyan.wrap('$results'))}\n',
Expand Down
4 changes: 2 additions & 2 deletions packages/mason_logger/test/src/mason_logger_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1691,7 +1691,7 @@ void main() {
);
});

test('ignores trailing delimter', () {
test('ignores trailing delimiter', () {
final keyStrokes = [
KeyStroke.char('d'),
KeyStroke.char('a'),
Expand Down Expand Up @@ -1809,7 +1809,7 @@ void main() {
);
});

test('backspace deletes delimeter', () {
test('backspace deletes delimiter', () {
final keyStrokes = [
KeyStroke.char('d'),
KeyStroke.char('a'),
Expand Down

0 comments on commit f3e4b38

Please sign in to comment.