Skip to content

Commit

Permalink
style: format with tall-style (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
halildurmus authored Feb 19, 2025
1 parent 3fbcf12 commit 6ac910b
Show file tree
Hide file tree
Showing 17 changed files with 391 additions and 289 deletions.
37 changes: 37 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Auto detect text files and perform LF normalization.
* text=auto

# Always perform LF normalization on these files.
*.dart text
*.expect text
*.gradle text
*.golden text eol=lf
*.html text
*.java text
*.json text
*.md text
*.mdx text
*.py text
*.sh text
*.txt text
*.xml text
*.yaml text

# Make sure that these Windows files always have CRLF line endings in checkout.
*.bat text eol=crlf
*.ps1 text eol=crlf
*.rc text eol=crlf
*.sln text eol=crlf
*.props text eol=crlf
*.vcxproj text eol=crlf
*.vcxproj.filters text eol=crlf
# Including templatized versions.
*.sln.tmpl text eol=crlf
*.props.tmpl text eol=crlf
*.vcxproj.tmpl text eol=crlf

# Never perform LF normalization on these files.
*.ico binary
*.jar binary
*.png binary
*.zip binary
46 changes: 28 additions & 18 deletions cliff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,20 @@ All notable changes to this project will be documented in this file.\n
# https://keats.github.io/tera/docs/#introduction
body = """
{% macro print_commit(commit) -%}
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
{% if commit.breaking %}[**breaking**] {% endif %}\
{{ commit.message | upper_first }} - \
([{{ commit.id | truncate(length=7, end="") }}](<REPO>/commit/{{ commit.id }}))\
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
{% if commit.breaking %}[**breaking**] {% endif %}\
{{ commit.message | split(pat="\n") | first | upper_first | trim }}\
{% if commit.remote.username %} by @{{ commit.remote.username }}{%- endif -%}
{% if commit.remote.pr_number %} in \
[#{{ commit.remote.pr_number }}](<REPO>/pull/{{ commit.remote.pr_number }}) \
{%- endif -%}
{% endmacro -%}
{% macro print_username(username) -%}
[@{{ username }}](<GITHUB>/{{ username }})
{% macro print_contributor(contributor) -%}
- @{{ contributor.username }} made their first contribution
{%- if contributor.pr_number %} in \
[#{{ contributor.pr_number }}](<REPO>/pull/{{ contributor.pr_number }}) \
{%- endif %}
{% endmacro -%}
{% if version %}\
Expand All @@ -46,15 +52,11 @@ body = """
{% endfor -%}
{%- if github -%}
{% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
## New Contributors ❤️
### New Contributors ❤️
{% endif %}\
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
* {{ self::print_username(username=contributor.username) }} \
made their first contribution
{%- if contributor.pr_number %} in \
[#{{ contributor.pr_number }}](<REPO>/pull/{{ contributor.pr_number }}) \
{%- endif %}
{%- endfor -%}
{{ self::print_contributor(contributor=contributor) }}
{%- endfor %}\n
{%- endif %}\n
"""
# template for the changelog footer
Expand All @@ -68,7 +70,8 @@ footer = """
{% else -%}
[unreleased]: <REPO>/compare/{{ release.previous.version }}..HEAD
{% endif -%}
{% endfor %}"""
{% endfor %}
"""
# remove the leading and trailing s
trim = true
# postprocessors
Expand All @@ -88,15 +91,22 @@ filter_unconventional = true
split_commits = false
# regex for preprocessing the commit messages
commit_preprocessors = [
# Replace issue numbers
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))" },
# remove issue numbers from commits
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "" },
]
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^feat", group = "<!-- 0 -->🚀 Features" },
{ message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
{ message = "^perf", group = "<!-- 2 -->⚡ Performance Improvements" },
{ message = "^refactor", group = "<!-- 3 -->🧹 Refactors" },
{ message = "^perf", group = "<!-- 2 -->⚡ Performance" },
{ message = "^refactor", group = "<!-- 3 -->🧹 Refactor" },
{ message = "^docs", group = "<!-- 4 -->📝 Documentation" },
{ message = "^test", group = "<!-- 5 -->🧪 Testing" },
{ message = "^style", group = "<!-- 6 -->🎨 Styling" },
{ message = "^chore\\(deps\\)", group = "<!-- 7 -->📦 Dependencies" },
{ message = "^chore\\(release\\): v", skip = true },
{ message = "^chore|^ci", group = "<!-- 8 -->⚙️ Miscellaneous Tasks" },
{ body = ".*security", group = "<!-- 9 -->🛡️ Security" },
]
# protect breaking changes from being skipped due to matching a skipping commit_parser
protect_breaking_commits = false
Expand Down
9 changes: 5 additions & 4 deletions example/create_values.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ void main() {
);
subkey.createValue(string);

const stringArray = RegistryValue.stringArray(
'TestStringArray',
['One', 'Two', 'Three'],
);
const stringArray = RegistryValue.stringArray('TestStringArray', [
'One',
'Two',
'Three',
]);
subkey.createValue(stringArray);

const unexpandedString = RegistryValue.unexpandedString(
Expand Down
7 changes: 4 additions & 3 deletions example/monitor_key.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ void main() async {
subkey.createValue(string);

// Subscribe to the onChanged stream to monitor changes to the subkey.
final subscription = subkey
.onChanged()
.listen((_) => print('Subkey changed.'), cancelOnError: true);
final subscription = subkey.onChanged().listen(
(_) => print('Subkey changed.'),
cancelOnError: true,
);

print('Monitoring registry key changes for 30 seconds...');
// Now, make a change to the subkey in RegEdit to trigger the onChanged event.
Expand Down
4 changes: 2 additions & 2 deletions example/read_values.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ void main() {
case Int32Value(:final value) || Int64Value(:final value):
print(' - $name ($type): $value');
case LinkValue(:final value) ||
StringValue(:final value) ||
UnexpandedStringValue(:final value):
StringValue(:final value) ||
UnexpandedStringValue(:final value):
print(' - $name ($type): $value');
case StringArrayValue(:final value):
print(' - $name ($type): $value');
Expand Down
8 changes: 4 additions & 4 deletions lib/src/access_rights.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ enum AccessRights {

@override
String toString() => switch (this) {
readOnly => 'KEY_READ',
writeOnly => 'KEY_WRITE',
allAccess => 'KEY_ALL_ACCESS'
};
readOnly => 'KEY_READ',
writeOnly => 'KEY_WRITE',
allAccess => 'KEY_ALL_ACCESS',
};
}
39 changes: 20 additions & 19 deletions lib/src/registry_hive.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,29 +52,30 @@ enum RegistryHive {
/// Throws an [ArgumentError] if the provided handle does not match any
/// predefined registry hive.
factory RegistryHive.fromWin32(int value) => switch (value) {
HKEY_CLASSES_ROOT => classesRoot,
HKEY_CURRENT_USER => currentUser,
HKEY_LOCAL_MACHINE => localMachine,
HKEY_USERS => allUsers,
HKEY_PERFORMANCE_DATA => performanceData,
HKEY_CURRENT_CONFIG => currentConfig,
_ => throw ArgumentError.value(
value,
'value',
'Unknown registry hive: $value',
),
};
HKEY_CLASSES_ROOT => classesRoot,
HKEY_CURRENT_USER => currentUser,
HKEY_LOCAL_MACHINE => localMachine,
HKEY_USERS => allUsers,
HKEY_PERFORMANCE_DATA => performanceData,
HKEY_CURRENT_CONFIG => currentConfig,
_ =>
throw ArgumentError.value(
value,
'value',
'Unknown registry hive: $value',
),
};

/// The handle representing a predefined registry key.
final int value;

@override
String toString() => switch (this) {
classesRoot => 'HKEY_CLASSES_ROOT',
currentUser => 'HKEY_CURRENT_USER',
localMachine => 'HKEY_LOCAL_MACHINE',
allUsers => 'HKEY_USERS',
performanceData => 'HKEY_PERFORMANCE_DATA',
currentConfig => 'HKEY_CURRENT_CONFIG',
};
classesRoot => 'HKEY_CLASSES_ROOT',
currentUser => 'HKEY_CURRENT_USER',
localMachine => 'HKEY_LOCAL_MACHINE',
allUsers => 'HKEY_USERS',
performanceData => 'HKEY_PERFORMANCE_DATA',
currentConfig => 'HKEY_CURRENT_CONFIG',
};
}
Loading

0 comments on commit 6ac910b

Please sign in to comment.