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

Set up Github actions to detect syntax and formatting errors. #66

Merged
merged 5 commits into from
Oct 7, 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
25 changes: 25 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Deploy application

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
render_document:
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v3
- name: Set up flutter-action
uses: subosito/flutter-action@v2
with:
flutter-version: '3.13.0'
channel: 'stable'
- name: Get dependencies
run: flutter pub get
- name: Detect formatting errors
run: dart format --line-length 80 --set-exit-if-changed --output none .
- name: Detect syntax errors
run: flutter analyze --no-pub .
3 changes: 2 additions & 1 deletion lib/app/themes/cosmic_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class Cosmic {
todayForegroundColor: MaterialStatePropertyAll(Colors.white),
yearForegroundColor: MaterialStatePropertyAll(Colors.white),
),
timePickerTheme: const TimePickerThemeData(backgroundColor: Color(0xFF49638B)),
timePickerTheme:
const TimePickerThemeData(backgroundColor: Color(0xFF49638B)),
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
foregroundColor: const Color.fromARGB(255, 48, 140, 221),
Expand Down
7 changes: 4 additions & 3 deletions lib/core/databases/sqflite_setup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ class DBProvider {
log.i("Inserting welcome note");
//as soon as the tables are created, insert a welcome note

String body = """[{\"insert\":\"Welcome to DiaryVault!\\n\\nKey Features:\\n\\n-Rich text editor with support for images and videos.\\n\\n-Your data is securely preserved on your Google Drive / Dropbox account, ensuring complete ownership and privacy\\r.\\n\\n-Sync data between multiple devices.\\r\\n\\n-Fingerprint login on supported devices.\\r\\n\\n-Multiple Themes.\\n\\n\\nHappy notemaking!\\nThe DiaryVault team.\\n\\n\"}]""";
String body =
"""[{\"insert\":\"Welcome to DiaryVault!\\n\\nKey Features:\\n\\n-Rich text editor with support for images and videos.\\n\\n-Your data is securely preserved on your Google Drive / Dropbox account, ensuring complete ownership and privacy\\r.\\n\\n-Sync data between multiple devices.\\r\\n\\n-Fingerprint login on supported devices.\\r\\n\\n-Multiple Themes.\\n\\n\\nHappy notemaking!\\nThe DiaryVault team.\\n\\n\"}]""";

Map<String,Object> notemap = {
Map<String, Object> notemap = {
Notes.ID: "f773a170-6447-11ee-9a76-c314b6be99a3",
Notes.CREATED_AT: DateTime.now().millisecondsSinceEpoch,
Notes.TITLE: "Welcome to DiaryVault",
Expand All @@ -80,7 +81,7 @@ class DBProvider {

log.i("All create queries executed successfully");
log.i("Welcome Note inserted into table: ${Notes.TABLE_NAME}");
// print note
// print note
await db.query(Notes.TABLE_NAME).then((value) => log.i(value));
} catch (e) {
log.e(e);
Expand Down
6 changes: 1 addition & 5 deletions lib/features/auth/presentation/bloc/cubit/theme_state.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
part of 'theme_cubit.dart';

enum Themes {
coralBubbles,
cosmic,
lushGreen
}
enum Themes { coralBubbles, cosmic, lushGreen }

String themeKey = "current_theme";

Expand Down
31 changes: 31 additions & 0 deletions pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

# Max line length for Dart files.
LINE_LENGTH=80

echo
echo "Running Dart Format, please wait…"
echo

if ! dart --disable-analytics format --fix --line-length $LINE_LENGTH "."; then
echo
echo "Fatal: Dart Format exited with an error. Please fix the issues and commit again."
echo
exit 1
fi

echo
echo "Running Dart Analysis, please wait…"
echo

# Run Dart Analysis on all modules.
if ! flutter --suppress-analytics analyze --no-pub "."; then
echo
echo "Dart Analysis found some issues. Please fix the issues and commit again."
echo
exit 1
fi

echo
echo "Dart Analysis found no issues, congratulations! Continuing with commit…"
echo
Loading