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

Create lint.yml workflow #11

Merged
merged 4 commits into from
Nov 3, 2023
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
42 changes: 42 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Run code static analysis

on:
push:
branches: ["main"]
pull_request:

concurrency:
group: lint-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
name: Run lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/[email protected]

- name: Setup Flutter
uses: subosito/flutter-action@v1

- name: Cache pub packages
uses: actions/cache@v2
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-cache-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-cache-

- name: Get dependencies
run: |
find . -type f -name pubspec.yaml -execdir flutter pub get \;

- name: Analyze code
run: |
dart analyze --fatal-infos --fatal-warnings

- name: Check code formatting
if: always()
run: |
dart format --output=none --set-exit-if-changed .
3 changes: 0 additions & 3 deletions auto_route/auto_route/test/auto_route_test.dart

This file was deleted.

2 changes: 1 addition & 1 deletion auto_route/generator/lib/auto_route_generator.dart
Original file line number Diff line number Diff line change
@@ -1 +1 @@
library auto_route_generator;
library auto_route_generator;
3 changes: 0 additions & 3 deletions auto_route/generator/test/auto_route_generator_test.dart

This file was deleted.

2 changes: 1 addition & 1 deletion flutter_toolkit/lib/src/commands/print_dart_define.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class PrintDartDefineCommand extends BaseCommand<IDartDefineConfig> {

@override
List<Action> actions() => [
PrintDartDefine(args),
PrintDartDefine(args).call,
];
}

Expand Down
12 changes: 7 additions & 5 deletions flutter_toolkit/lib/src/commands/project_setup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ class ProjectSetupCommand extends BaseCommand<IFlutterFireConfig> {

@override
List<Action> actions() => [
InstallFirebaseCliIfNeeded(),
LoginToFirebaseIfNeeded(),
RemoveOldConfigFiles(),
FlutterFireConfigure(args),
RemoveUnusedClientInfo(androidPackageName: args.androidPackageName),
InstallFirebaseCliIfNeeded().call,
LoginToFirebaseIfNeeded().call,
RemoveOldConfigFiles().call,
FlutterFireConfigure(args).call,
RemoveUnusedClientInfo(
androidPackageName: args.androidPackageName,
).call,
];
}

Expand Down
2 changes: 1 addition & 1 deletion flutter_toolkit/lib/src/commands/run_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class RunAppCommand extends BaseCommand<List<String>> {

@override
List<Action> actions() => [
FvmFlutterRun(flutterRunArgs: argResults!.arguments),
FvmFlutterRun(flutterRunArgs: argResults!.arguments).call,
];
}

Expand Down
2 changes: 1 addition & 1 deletion flutter_toolkit/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies:
fvm: <3.0.0
meta: any
path: any
process_run: ^0.13.0
process_run: any
yaml: ^3.1.1

dev_dependencies:
Expand Down
2 changes: 1 addition & 1 deletion logify/example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// example/main.dart
import 'package:logify/logify.dart';
import 'package:logging/logging.dart';
import 'package:logify/logify.dart';

void main() {
Logger.root.level = Level.ALL;
Expand Down
6 changes: 3 additions & 3 deletions logify/lib/src/log_recorder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ abstract class LogRecorder {
LogRecorder({
Stdout? stdout,
Stdout? stderr,
}) : stdout = stdout ?? io.stdout,
stderr = stderr ?? io.stderr;
}) : stdout = stdout ?? io.stdout,
stderr = stderr ?? io.stderr;

final Stdout stdout;
final Stdout stderr;

bool get forceStackTrace => false;

String record(LogRecord record);
Expand Down
2 changes: 1 addition & 1 deletion logify/lib/src/logger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Log {

static StreamSubscription<LogRecord> listen(LogRecorder recorder) {
forceStackTrace |= recorder.forceStackTrace;
return _log.onRecord.listen(recorder);
return _log.onRecord.listen(recorder.call);
}

static void clearListeners() {
Expand Down
9 changes: 6 additions & 3 deletions logify/lib/src/platform/print.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ void debugPrintThrottled(String? message) {
_debugPrintTask();
}
}

int _debugPrintedCharacters = 0;
const int _kDebugPrintCapacity = 12 * 1024;
const Duration _kDebugPrintPauseTime = Duration(seconds: 1);
Expand All @@ -62,9 +63,10 @@ void _debugPrintTask() {
_debugPrintStopwatch.reset();
_debugPrintedCharacters = 0;
}
while (_debugPrintedCharacters < _kDebugPrintCapacity && _debugPrintBuffer.isNotEmpty) {
while (_debugPrintedCharacters < _kDebugPrintCapacity &&
_debugPrintBuffer.isNotEmpty) {
final String line = _debugPrintBuffer.removeFirst();
_debugPrintedCharacters += line.length; // TODO(ianh): Use the UTF-8 byte length instead
_debugPrintedCharacters += line.length;
print(line);
}
if (_debugPrintBuffer.isNotEmpty) {
Expand All @@ -82,4 +84,5 @@ void _debugPrintTask() {
/// A Future that resolves when there is no longer any buffered content being
/// printed by [debugPrintThrottled] (which is the default implementation for
/// [debugPrint], which is used to report errors to the console).
Future<void> get debugPrintDone => _debugPrintCompleter?.future ?? Future<void>.value();
Future<void> get debugPrintDone =>
_debugPrintCompleter?.future ?? Future<void>.value();
2 changes: 1 addition & 1 deletion logify/lib/src/recorder/debug_log_recorder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class DebugLogRecorder extends LogRecorder with LogRecorderTemplateMixin {
case 'message':
return record.message.colored(color);
case 'location':
/// maybe make this configurable from [params]?
// maybe make this configurable from [params]?
final location = record.location;
if (location == null) return '';
return _applyPadding(stdout, record.message, location)
Expand Down
3 changes: 2 additions & 1 deletion logify/lib/src/utils/color.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// Uses ANSI escape codes to color the console.
/// Color value is based on the 8-color ANSI standard.
///
///
/// for more info see: https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
class ConsoleColor {
const ConsoleColor._(
Expand All @@ -20,6 +20,7 @@ class ConsoleColor {

/// Use this to reset the console color.
factory ConsoleColor.defaults() = _ConsoleColorDefault;

/// Use this to disable colors.
factory ConsoleColor.none() = _ConsoleColorNone;

Expand Down
2 changes: 1 addition & 1 deletion logify/lib/src/utils/string.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ extension StringExt on String {
}

/// Replace all occurrences of {index} with the corresponding parameter..
///
///
/// Example:
/// ```
/// '{0} {2} {0}'.format(['foo', 'bar', 'baz', 'qux']);
Expand Down
2 changes: 1 addition & 1 deletion shic/lib/src/interceptable_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class InterceptableClient extends BaseClient {
final Iterable<HttpInterceptor> interceptors;

ChainInterceptor get _chain =>
interceptors.toList().reversed.fold(_client, _chainInterceptor);
interceptors.toList().reversed.fold(_client.call, _chainInterceptor);

@override
Future<StreamedResponse> send(BaseRequest request) => _chain.call(request);
Expand Down
2 changes: 1 addition & 1 deletion simple_nav/lib/simple_nav.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
library simple_nav;

export 'src/route_resolver.dart';
export 'src/route_resolver.dart';