|
| 1 | +# GitHub Copilot Instructions for WiFiAnalyzer |
| 2 | + |
| 3 | +## Project Overview |
| 4 | + |
| 5 | +WiFiAnalyzer is an Android application for analyzing WiFi networks. It helps users: |
| 6 | +- Identify nearby Access Points |
| 7 | +- Graph channel signal strength |
| 8 | +- Analyze Wi-Fi networks to rate channels |
| 9 | +- Support 2.4 GHz, 5 GHz and 6 GHz Wi-Fi bands |
| 10 | +- Export access point details |
| 11 | + |
| 12 | +**Important**: WiFiAnalyzer is NOT a Wi-Fi password cracking or phishing tool. |
| 13 | + |
| 14 | +## Technology Stack |
| 15 | + |
| 16 | +- **Language**: Kotlin |
| 17 | +- **Platform**: Android |
| 18 | +- **Build Tool**: Gradle |
| 19 | +- **Testing**: JUnit, Mockito, Robolectric |
| 20 | +- **Code Style**: ktlint |
| 21 | +- **License**: GNU General Public License v3.0 (GPLv3) |
| 22 | + |
| 23 | +## Coding Standards and Conventions |
| 24 | + |
| 25 | +### Kotlin Style Guide |
| 26 | + |
| 27 | +1. **Code Formatting**: Use ktlint for code formatting |
| 28 | + - Run `./gradlew ktlintCheck` to check code style |
| 29 | + - Run `./gradlew ktlintFormat` to auto-format code |
| 30 | + |
| 31 | +2. **File Headers**: All source files must include the GPLv3 license header: |
| 32 | + ```kotlin |
| 33 | + /* |
| 34 | + * WiFiAnalyzer |
| 35 | + * Copyright (C) 2015 - 2025 VREM Software Development <[email protected]> |
| 36 | + * |
| 37 | + * This program is free software: you can redistribute it and/or modify |
| 38 | + * it under the terms of the GNU General Public License as published by |
| 39 | + * the Free Software Foundation, either version 3 of the License, or |
| 40 | + * (at your option) any later version. |
| 41 | + * |
| 42 | + * This program is distributed in the hope that it will be useful, |
| 43 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 44 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 45 | + * GNU General Public License for more details. |
| 46 | + * |
| 47 | + * You should have received a copy of the GNU General Public License |
| 48 | + * along with this program. If not, see <http://www.gnu.org/licenses/> |
| 49 | + */ |
| 50 | + ``` |
| 51 | + |
| 52 | +3. **Naming Conventions**: |
| 53 | + - Use descriptive names for classes, methods, and variables |
| 54 | + - Follow Kotlin naming conventions (camelCase for variables/methods, PascalCase for classes) |
| 55 | + |
| 56 | +4. **Code Organization**: |
| 57 | + - Main source code: `app/src/main/kotlin/` |
| 58 | + - Test code: `app/src/test/kotlin/` |
| 59 | + - Android tests: `app/src/androidTest/kotlin/` |
| 60 | + |
| 61 | +### Testing Requirements |
| 62 | + |
| 63 | +1. **Unit Tests are Mandatory**: |
| 64 | + - All new features and bug fixes MUST include unit tests |
| 65 | + - Maintain or improve code coverage (currently tracked via Codecov) |
| 66 | + - Use Mockito for mocking dependencies |
| 67 | + - Use Robolectric for Android-specific testing |
| 68 | + |
| 69 | +2. **Test File Naming**: Test files should follow the pattern `[ClassName]Test.kt` |
| 70 | + |
| 71 | +3. **Test Structure**: Follow the AAA pattern: |
| 72 | + - Arrange: Set up test data and mocks |
| 73 | + - Act: Execute the code being tested |
| 74 | + - Assert: Verify the results |
| 75 | + |
| 76 | +4. **Running Tests**: |
| 77 | + - Unit tests: `./gradlew testDebugUnitTest` |
| 78 | + - Unit tests with coverage: `./gradlew jacocoTestCoverageVerification` |
| 79 | + - Test reports: `app/build/reports/tests/testDebugUnitTest/index.html` |
| 80 | + - Coverage reports: `app/build/reports/jacoco/jacocoTestReport/html/index.html` |
| 81 | + |
| 82 | +## Build and Development Workflow |
| 83 | + |
| 84 | +### Building the Project |
| 85 | + |
| 86 | +1. **Initial Setup**: |
| 87 | + - Install Android Studio |
| 88 | + - Import the project into Android Studio |
| 89 | + - The project will build automatically |
| 90 | + |
| 91 | +2. **Gradle Commands**: |
| 92 | + - Check code style: `./gradlew ktlintCheck` |
| 93 | + - Format code: `./gradlew ktlintFormat` |
| 94 | + - Run lint: `./gradlew lintDebug` |
| 95 | + - Run tests: `./gradlew testDebugUnitTest` |
| 96 | + - Coverage: `./gradlew jacocoTestCoverageVerification` |
| 97 | + |
| 98 | +3. **Reports Location**: |
| 99 | + - Lint: `app/build/reports/lint-results.html` |
| 100 | + - Tests: `app/build/reports/tests/testDebugUnitTest/index.html` |
| 101 | + - Coverage: `app/build/reports/jacoco/jacocoTestReport/html/index.html` |
| 102 | + |
| 103 | +### Continuous Integration |
| 104 | + |
| 105 | +GitHub Actions automatically runs on every push and pull request: |
| 106 | +- Code style check with ktlint |
| 107 | +- Lint analysis |
| 108 | +- Unit tests with coverage (uploaded to Codecov) |
| 109 | +- APK build (debug) |
| 110 | +- Artifacts (reports and APK) available for download |
| 111 | + |
| 112 | +## Pull Request Guidelines |
| 113 | + |
| 114 | +1. **Before Submitting**: |
| 115 | + - Search existing issues (open and closed) to avoid duplicates |
| 116 | + - Comment on the issue you're working on |
| 117 | + - Keep changes focused and avoid large change sets |
| 118 | + - Include unit tests for all changes |
| 119 | + |
| 120 | +2. **PR Description**: |
| 121 | + - Provide a clear description of changes |
| 122 | + - Reference related issues (use "Closes #123" to auto-close issues) |
| 123 | + - Include testing details (OS, platform, toolchain version) |
| 124 | + |
| 125 | +3. **Commit Messages**: |
| 126 | + - Use clear, descriptive commit messages |
| 127 | + - Reference issues in commit messages when applicable |
| 128 | + |
| 129 | +## Project-Specific Guidelines |
| 130 | + |
| 131 | +### Privacy and Security |
| 132 | + |
| 133 | +1. **No Data Collection**: WiFiAnalyzer does not collect any personal/device information |
| 134 | +2. **No Internet**: The app does not require internet access |
| 135 | +3. **Minimal Permissions**: Use only necessary Android permissions |
| 136 | +4. **No Secrets**: Never commit API keys, passwords, or other secrets |
| 137 | + |
| 138 | +### Feature Development |
| 139 | + |
| 140 | +1. **Open Source Focus**: Remember this is an open-source project under GPLv3 |
| 141 | +2. **User Privacy**: Prioritize user privacy in all features |
| 142 | +3. **Android Compatibility**: Test on various Android versions when possible |
| 143 | +4. **Documentation**: Update README.md or USER_MANUAL.md if adding user-facing features |
| 144 | + |
| 145 | +### Bug Fixes |
| 146 | + |
| 147 | +1. **Reproducibility**: Ensure bugs are reproducible before fixing |
| 148 | +2. **Device Information**: Consider that bugs may be device or Android version-specific |
| 149 | +3. **Screenshots**: Provide screenshots for UI-related bugs when applicable |
| 150 | + |
| 151 | +### Translation and Localization |
| 152 | + |
| 153 | +- WiFiAnalyzer supports multiple languages via Weblate |
| 154 | +- Translation changes should be made through the Weblate project |
| 155 | +- Do not manually edit translation files unless absolutely necessary |
| 156 | + |
| 157 | +## Common Patterns in the Codebase |
| 158 | + |
| 159 | +1. **Mockito Usage**: Tests use Mockito with Kotlin extensions: |
| 160 | + ```kotlin |
| 161 | + import org.mockito.kotlin.mock |
| 162 | + import org.mockito.kotlin.verify |
| 163 | + import org.mockito.kotlin.whenever |
| 164 | + ``` |
| 165 | + |
| 166 | +2. **Test Teardown**: Tests typically verify no unexpected interactions: |
| 167 | + ```kotlin |
| 168 | + @After |
| 169 | + fun tearDown() { |
| 170 | + verifyNoMoreInteractions(dependency1, dependency2) |
| 171 | + } |
| 172 | + ``` |
| 173 | + |
| 174 | +3. **Robolectric Tests**: Android component tests use Robolectric: |
| 175 | + ```kotlin |
| 176 | + val activity = Robolectric |
| 177 | + .buildActivity(MainActivity::class.java) |
| 178 | + .create() |
| 179 | + .resume() |
| 180 | + .get() |
| 181 | + ``` |
| 182 | + |
| 183 | +## Resources |
| 184 | + |
| 185 | +- [Contributing Guidelines](../CONTRIBUTING.md) |
| 186 | +- [Pull Request Template](../PULL_REQUEST_TEMPLATE.md) |
| 187 | +- [User Manual](../USER_MANUAL.md) |
| 188 | +- [Weblate Translation Project](https://hosted.weblate.org/engage/wifianalyzer/) |
| 189 | + |
| 190 | +## Questions or Issues? |
| 191 | + |
| 192 | +- Open an issue on GitHub for bugs or feature requests |
| 193 | +- Check existing issues before creating new ones |
| 194 | +- Use GitHub Discussions for general questions |
0 commit comments