Skip to content

Commit d025e77

Browse files
authored
Merge pull request #1 from codeforgood-org/claude/reorganize-enhance-repo-011CV6HfWcq2uJRhS1C6bhV9
Enhance repo and code organization
2 parents 637efd5 + 57a0642 commit d025e77

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+8271
-98
lines changed

.credo.exs

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# This file contains the configuration for Credo
2+
#
3+
# If you find that you need to change the default configuration,
4+
# it's easiest to just edit this file directly.
5+
#
6+
# More information on Credo can be found here:
7+
# https://github.com/rrrene/credo
8+
%{
9+
configs: [
10+
%{
11+
name: "default",
12+
files: %{
13+
included: ["lib/", "test/"],
14+
excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"]
15+
},
16+
plugins: [],
17+
requires: [],
18+
strict: false,
19+
parse_timeout: 5000,
20+
color: true,
21+
checks: %{
22+
enabled: [
23+
## Consistency Checks
24+
{Credo.Check.Consistency.ExceptionNames, []},
25+
{Credo.Check.Consistency.LineEndings, []},
26+
{Credo.Check.Consistency.ParameterPatternMatching, []},
27+
{Credo.Check.Consistency.SpaceAroundOperators, []},
28+
{Credo.Check.Consistency.SpaceInParentheses, []},
29+
{Credo.Check.Consistency.TabsOrSpaces, []},
30+
31+
## Design Checks
32+
{Credo.Check.Design.AliasUsage, [priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 0]},
33+
{Credo.Check.Design.TagFIXME, []},
34+
{Credo.Check.Design.TagTODO, [exit_status: 0]},
35+
36+
## Readability Checks
37+
{Credo.Check.Readability.AliasOrder, []},
38+
{Credo.Check.Readability.FunctionNames, []},
39+
{Credo.Check.Readability.LargeNumbers, []},
40+
{Credo.Check.Readability.MaxLineLength, [priority: :low, max_length: 120]},
41+
{Credo.Check.Readability.ModuleAttributeNames, []},
42+
{Credo.Check.Readability.ModuleDoc, []},
43+
{Credo.Check.Readability.ModuleNames, []},
44+
{Credo.Check.Readability.ParenthesesInCondition, []},
45+
{Credo.Check.Readability.ParenthesesOnZeroArityDefs, []},
46+
{Credo.Check.Readability.PipeIntoAnonymousFunctions, []},
47+
{Credo.Check.Readability.PredicateFunctionNames, []},
48+
{Credo.Check.Readability.PreferImplicitTry, []},
49+
{Credo.Check.Readability.RedundantBlankLines, []},
50+
{Credo.Check.Readability.Semicolons, []},
51+
{Credo.Check.Readability.SpaceAfterCommas, []},
52+
{Credo.Check.Readability.StringSigils, []},
53+
{Credo.Check.Readability.TrailingBlankLine, []},
54+
{Credo.Check.Readability.TrailingWhiteSpace, []},
55+
{Credo.Check.Readability.UnnecessaryAliasExpansion, []},
56+
{Credo.Check.Readability.VariableNames, []},
57+
{Credo.Check.Readability.WithSingleClause, []},
58+
59+
## Refactoring Opportunities
60+
{Credo.Check.Refactor.Apply, []},
61+
{Credo.Check.Refactor.CondStatements, []},
62+
{Credo.Check.Refactor.CyclomaticComplexity, []},
63+
{Credo.Check.Refactor.FunctionArity, []},
64+
{Credo.Check.Refactor.LongQuoteBlocks, []},
65+
{Credo.Check.Refactor.MatchInCondition, []},
66+
{Credo.Check.Refactor.MapJoin, []},
67+
{Credo.Check.Refactor.NegatedConditionsInUnless, []},
68+
{Credo.Check.Refactor.NegatedConditionsWithElse, []},
69+
{Credo.Check.Refactor.Nesting, []},
70+
{Credo.Check.Refactor.UnlessWithElse, []},
71+
{Credo.Check.Refactor.WithClauses, []},
72+
{Credo.Check.Refactor.FilterFilter, []},
73+
{Credo.Check.Refactor.RejectReject, []},
74+
{Credo.Check.Refactor.RedundantWithClauseResult, []},
75+
76+
## Warnings
77+
{Credo.Check.Warning.ApplicationConfigInModuleAttribute, []},
78+
{Credo.Check.Warning.BoolOperationOnSameValues, []},
79+
{Credo.Check.Warning.ExpensiveEmptyEnumCheck, []},
80+
{Credo.Check.Warning.IExPry, []},
81+
{Credo.Check.Warning.IoInspect, []},
82+
{Credo.Check.Warning.OperationOnSameValues, []},
83+
{Credo.Check.Warning.OperationWithConstantResult, []},
84+
{Credo.Check.Warning.RaiseInsideRescue, []},
85+
{Credo.Check.Warning.SpecWithStruct, []},
86+
{Credo.Check.Warning.WrongTestFileExtension, []},
87+
{Credo.Check.Warning.UnusedEnumOperation, []},
88+
{Credo.Check.Warning.UnusedFileOperation, []},
89+
{Credo.Check.Warning.UnusedKeywordOperation, []},
90+
{Credo.Check.Warning.UnusedListOperation, []},
91+
{Credo.Check.Warning.UnusedPathOperation, []},
92+
{Credo.Check.Warning.UnusedRegexOperation, []},
93+
{Credo.Check.Warning.UnusedStringOperation, []},
94+
{Credo.Check.Warning.UnusedTupleOperation, []},
95+
{Credo.Check.Warning.UnsafeExec, []}
96+
],
97+
disabled: [
98+
# Controversial and experimental checks (opt-in, just move the check to `:enabled`)
99+
{Credo.Check.Consistency.MultiAliasImportRequireUse, []},
100+
{Credo.Check.Consistency.UnusedVariableNames, []},
101+
{Credo.Check.Design.DuplicatedCode, []},
102+
{Credo.Check.Design.SkipTestWithoutComment, []},
103+
{Credo.Check.Readability.AliasAs, []},
104+
{Credo.Check.Readability.BlockPipe, []},
105+
{Credo.Check.Readability.ImplTrue, []},
106+
{Credo.Check.Readability.MultiAlias, []},
107+
{Credo.Check.Readability.NestedFunctionCalls, []},
108+
{Credo.Check.Readability.SeparateAliasRequire, []},
109+
{Credo.Check.Readability.SingleFunctionToBlockPipe, []},
110+
{Credo.Check.Readability.SinglePipe, []},
111+
{Credo.Check.Readability.Specs, []},
112+
{Credo.Check.Readability.StrictModuleLayout, []},
113+
{Credo.Check.Readability.WithCustomTaggedTuple, []},
114+
{Credo.Check.Refactor.ABCSize, []},
115+
{Credo.Check.Refactor.AppendSingleItem, []},
116+
{Credo.Check.Refactor.DoubleBooleanNegation, []},
117+
{Credo.Check.Refactor.FilterReject, []},
118+
{Credo.Check.Refactor.IoPuts, []},
119+
{Credo.Check.Refactor.MapMap, []},
120+
{Credo.Check.Refactor.ModuleDependencies, []},
121+
{Credo.Check.Refactor.NegatedIsNil, []},
122+
{Credo.Check.Refactor.PipeChainStart, []},
123+
{Credo.Check.Refactor.RejectFilter, []},
124+
{Credo.Check.Refactor.VariableRebinding, []},
125+
{Credo.Check.Warning.LazyLogging, []},
126+
{Credo.Check.Warning.LeakyEnvironment, []},
127+
{Credo.Check.Warning.MapGetUnsafePass, []},
128+
{Credo.Check.Warning.MixEnv, []},
129+
{Credo.Check.Warning.UnsafeToAtom, []}
130+
]
131+
}
132+
}
133+
]
134+
}

.dockerignore

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Git
2+
.git
3+
.gitignore
4+
5+
# Build artifacts
6+
_build
7+
deps
8+
*.ez
9+
blog_engine
10+
11+
# Documentation
12+
doc
13+
docs
14+
15+
# Test
16+
test
17+
cover
18+
*.coverdata
19+
20+
# Development
21+
.elixir_ls
22+
.vscode
23+
.idea
24+
25+
# OS
26+
.DS_Store
27+
Thumbs.db
28+
29+
# Data files (mount as volume instead)
30+
priv/data/*.json
31+
32+
# CI/CD
33+
.github
34+
35+
# Other
36+
README.md
37+
CHANGELOG.md
38+
CONTRIBUTING.md
39+
CODE_OF_CONDUCT.md
40+
SECURITY.md
41+
Makefile
42+
examples
43+
scripts
44+
backups

.editorconfig

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# This file is used by various editors and IDEs to maintain
2+
# consistent coding styles across different editors and IDEs.
3+
# See https://editorconfig.org for more information.
4+
5+
root = true
6+
7+
[*]
8+
charset = utf-8
9+
end_of_line = lf
10+
indent_style = space
11+
indent_size = 2
12+
insert_final_newline = true
13+
trim_trailing_whitespace = true
14+
15+
[*.{ex,exs}]
16+
indent_style = space
17+
indent_size = 2
18+
19+
[*.{md,markdown}]
20+
trim_trailing_whitespace = false
21+
22+
[*.{yml,yaml}]
23+
indent_size = 2
24+
25+
[Makefile]
26+
indent_style = tab
27+
28+
[*.json]
29+
indent_size = 2
30+
31+
[*.sh]
32+
indent_style = space
33+
indent_size = 2

.formatter.exs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Used by "mix format"
2+
[
3+
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"],
4+
line_length: 120
5+
]

.git-hooks/commit-msg

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
3+
# Commit message hook for BlogEngine
4+
# Validates commit message format
5+
# Install: ln -sf ../../.git-hooks/commit-msg .git/hooks/commit-msg
6+
7+
commit_msg_file=$1
8+
commit_msg=$(cat "$commit_msg_file")
9+
10+
# Skip merge commits
11+
if echo "$commit_msg" | grep -q "^Merge"; then
12+
exit 0
13+
fi
14+
15+
# Check minimum length
16+
if [ ${#commit_msg} -lt 10 ]; then
17+
echo "❌ Commit message too short (minimum 10 characters)"
18+
echo " Current: ${#commit_msg} characters"
19+
exit 1
20+
fi
21+
22+
# Check for imperative mood (starts with verb)
23+
first_word=$(echo "$commit_msg" | head -n1 | awk '{print $1}')
24+
if echo "$first_word" | grep -qE '^(Add|Fix|Update|Remove|Refactor|Document|Test|Improve|Create|Delete|Move|Rename|Extract|Optimize|Merge|Bump|Revert)'; then
25+
exit 0
26+
fi
27+
28+
# Warning for non-standard format
29+
echo "⚠️ Warning: Commit message should start with an imperative verb"
30+
echo " Examples: Add, Fix, Update, Remove, Refactor, etc."
31+
echo " Current: $first_word"
32+
echo ""
33+
echo "Continue anyway? (y/N)"
34+
read -r response
35+
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
36+
exit 0
37+
else
38+
exit 1
39+
fi

.git-hooks/pre-commit

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
3+
# Pre-commit hook for BlogEngine
4+
# Runs code quality checks before allowing commit
5+
# Install: ln -sf ../../.git-hooks/pre-commit .git/hooks/pre-commit
6+
7+
set -e
8+
9+
echo "Running pre-commit checks..."
10+
echo ""
11+
12+
# Check if mix is available
13+
if ! command -v mix &> /dev/null; then
14+
echo "⚠️ Mix not found. Skipping Elixir checks."
15+
exit 0
16+
fi
17+
18+
# Run formatter check
19+
echo "🔍 Checking code formatting..."
20+
if ! mix format --check-formatted 2>&1 | grep -q "mix format"; then
21+
echo "✓ Code is properly formatted"
22+
else
23+
echo "❌ Code formatting issues found"
24+
echo " Run: mix format"
25+
exit 1
26+
fi
27+
28+
# Run Credo
29+
echo ""
30+
echo "🔍 Running Credo..."
31+
if mix credo --strict 2>&1 | grep -q "Warnings"; then
32+
echo "⚠️ Credo warnings found"
33+
echo " Run: mix credo --strict"
34+
# Don't fail on warnings, just notify
35+
else
36+
echo "✓ Credo checks passed"
37+
fi
38+
39+
# Run tests
40+
echo ""
41+
echo "🧪 Running tests..."
42+
if mix test --trace; then
43+
echo "✓ All tests passed"
44+
else
45+
echo "❌ Tests failed"
46+
exit 1
47+
fi
48+
49+
echo ""
50+
echo "✅ Pre-commit checks passed!"
51+
echo ""

.github/FUNDING.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Funding options for BlogEngine
2+
# Uncomment and update with your funding platforms
3+
4+
# github: [codeforgood-org]
5+
# patreon: username
6+
# open_collective: blogengine
7+
# ko_fi: username
8+
# tidelift: npm/package-name
9+
# community_bridge: project-name
10+
# liberapay: username
11+
# issuehunt: username
12+
# custom: ['https://example.com']
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
name: Bug Report
3+
about: Create a report to help us improve
4+
title: '[BUG] '
5+
labels: bug
6+
assignees: ''
7+
---
8+
9+
## Bug Description
10+
11+
A clear and concise description of what the bug is.
12+
13+
## Steps To Reproduce
14+
15+
1. Go to '...'
16+
2. Run command '...'
17+
3. Enter input '...'
18+
4. See error
19+
20+
## Expected Behavior
21+
22+
A clear and concise description of what you expected to happen.
23+
24+
## Actual Behavior
25+
26+
A clear and concise description of what actually happened.
27+
28+
## Error Messages
29+
30+
```
31+
Paste any error messages here
32+
```
33+
34+
## Environment
35+
36+
- **OS:** [e.g. macOS 13.0, Ubuntu 22.04, Windows 11]
37+
- **Elixir version:** [run `elixir --version`]
38+
- **Erlang/OTP version:** [shown in `elixir --version` output]
39+
- **BlogEngine version/commit:** [e.g. v1.0.0 or commit hash]
40+
41+
## Additional Context
42+
43+
Add any other context about the problem here. Screenshots, logs, or data files can be helpful.
44+
45+
## Possible Solution
46+
47+
If you have ideas about what might be causing this or how to fix it, please share!

0 commit comments

Comments
 (0)