Skip to content
Open
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
18 changes: 18 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[flake8]
max-line-length = 120
extend-ignore = E203, W503
exclude =
.git,
__pycache__,
.venv,
venv,
build,
dist,
*.egg-info,
.mypy_cache,
.pytest_cache,
htmlcov
per-file-ignores =
__init__.py:F401
tests/*.py:D100,D101,D102,D103
max-complexity = 10
101 changes: 101 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Test and Lint

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Cache pip packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"

- name: Run tests with pytest
run: |
pytest tests/ -v --tb=short --cov=src/slack_mcp --cov-report=term-missing --cov-report=html

- name: Upload coverage reports
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: htmlcov/
if: always()

# Linting checks (non-blocking)
- name: Run flake8 linting
run: |
flake8 src/ --count --statistics || true
continue-on-error: true

- name: Run mypy type checking
run: |
mypy src/ || true
continue-on-error: true

- name: Check code formatting with black
run: |
black --check src/ || true
continue-on-error: true

- name: Check import sorting with isort
run: |
isort --check-only src/ || true
continue-on-error: true

# Post linting results as comment (for PRs)
- name: Comment linting results
uses: actions/github-script@v7
if: github.event_name == 'pull_request'
with:
script: |
const output = `
## 🔍 Linting Results (Non-blocking)

The following linting checks were run. These are informational only and will not block the merge:

- **flake8**: Check the job logs for style issues
- **mypy**: Check the job logs for type checking issues
- **black**: Check the job logs for formatting suggestions
- **isort**: Check the job logs for import sorting suggestions

To run these locally:
\`\`\`bash
pip install -e ".[dev]"
flake8 src/
mypy src/
black --check src/
isort --check-only src/
\`\`\`
`;

github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})
continue-on-error: true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Python
__pycache__/
*.py[cod]
*.pyc
*$py.class
*.so
.Python
Expand Down Expand Up @@ -68,6 +69,7 @@ htmlcov/
.pytest_cache/
.tox/
.cache
.mypy_cache/

# Jupyter
.ipynb_checkpoints
Expand Down
83 changes: 83 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,86 @@ dependencies = [
"python-dotenv>=1.1.1",
"slack-sdk>=3.35.0",
]

[project.optional-dependencies]
dev = [
"pytest>=8.0.0",
"pytest-asyncio>=0.23.0",
"pytest-cov>=4.1.0",
"flake8>=7.0.0",
"mypy>=1.8.0",
"black>=24.0.0",
"isort>=5.13.0",
]

[tool.black]
line-length = 120
target-version = ['py312']
include = '\.pyi?$'
extend-exclude = '''
/(
# directories
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| build
| dist
)/
'''

[tool.isort]
profile = "black"
line_length = 120
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true

[tool.mypy]
python_version = "3.12"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = false
disallow_incomplete_defs = false
check_untyped_defs = true
disallow_untyped_decorators = false
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
follow_imports = "normal"
ignore_missing_imports = true

[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = "test_*.py"
python_classes = "Test*"
python_functions = "test_*"
addopts = "-v --tb=short --strict-markers"
asyncio_mode = "auto"
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: marks tests as integration tests",
]

[tool.coverage.run]
source = ["src"]
omit = [
"*/tests/*",
"*/test_*.py",
"*/__init__.py",
]

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
]
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Test package for Slack MCP Server."""
Loading
Loading