Skip to content

Auto Generate structured project documentation using Diátaxis framework #730

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

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft
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
83 changes: 83 additions & 0 deletions docs/api-report/contrib_tracker-README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
```markdown
# Contrib Tracker

## Description

The Contrib Tracker module is designed to track contributions from Drupal.org users. It provides a mechanism to collect and display data related to individual contributions within the Drupal ecosystem.

## Installation

1. Download the module from [Drupal.org](insert link to project page).
2. Place the module in your Drupal installation's `modules` directory (e.g., `/modules/contrib`).
3. Enable the module by navigating to the "Extend" page in your Drupal administration interface (`/admin/modules`). Search for "Contrib Tracker" and check the box to enable it.
4. Click "Install" to complete the installation process.

## Usage

After installation, the module provides services that can be used by other modules or custom code. See the "API" section for more details on available services.

## Configuration

This module does not have a user interface for configuration. Its functionality is primarily accessed through its provided services. Any configuration would typically be done via code or through integrating modules that interact with Contrib Tracker's API.

## API

### Services

The Contrib Tracker module exposes the following services:

* **services:** (Detailed information of services to be added.)
* [Service Name 1]: Description of what this service does, its parameters, and return values.
* [Service Name 2]: Description of what this service does, its parameters, and return values.
* (Add more services as applicable)

**Example Usage (hypothetical, replace with actual service usage):**

```php
// Example of using a Contrib Tracker service (Replace with actual service name)
$contrib_tracker_service = \Drupal::service('contrib_tracker.example_service');
$result = $contrib_tracker_service->doSomething('username');
\Drupal::logger('contrib_tracker')->notice('Contrib Tracker Service Result: @result', ['@result' => $result]);
```

## Examples

Because this module is service-oriented, examples typically involve interacting with the provided services from within custom Drupal modules or Drush scripts. Here are some abstract example scenarios:

* **Fetching User Contributions:** A module might use the `contrib_tracker.user_contribution_service` to retrieve a list of a specific user's contributions on Drupal.org.
* **Displaying Contribution Statistics:** A custom block can use the module's services to display aggregated contribution statistics (e.g., total patches, contributed modules) on a website.
* **Automated Reporting:** A Drush command could leverage the services to generate regular reports about community contributions.

(Replace these with actual, specific examples when the module's capabilities become defined.)

## Dependencies

This module has no dependencies.

## Known Issues

There are currently no known issues.

## Contributing

We welcome contributions to the Contrib Tracker module! To contribute:

1. Fork the repository on [Drupal.org](insert link to project page).
2. Create a new branch for your feature or bug fix.
3. Implement your changes, following Drupal coding standards.
4. Write tests to ensure the stability of your changes.
5. Submit a merge request to the main branch.

Please ensure that your merge requests include clear descriptions of the changes made and the reason for the changes.

## Changelog

### Version 1.0.0 (2024-01-01)
* Initial Release.

(Maintain a list of changes with each release)

## License

This project is licensed under the [GPL-2.0-or-later](https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) license.
```
102 changes: 102 additions & 0 deletions docs/api-report/ct_drupal-README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
```markdown
# Drupal.org Contribution Tracker

## Description

The Drupal.org Contribution Tracker is a module designed to track and analyze the contributions of users on Drupal.org. It provides insights into user activity, such as issue comments, patch submissions, and project maintainership, allowing for a comprehensive view of their involvement in the Drupal community.

## Installation

1. Download the module to your Drupal installation's modules directory (e.g., `/modules/contrib`).
2. Enable the module via the Drupal administration interface (`/admin/modules`). You can use Drush: `drush en drupalorg_contribution_tracker`
3. Configure the module settings as required (see Configuration section).

## Usage

After installation, the module begins tracking user contributions based on the configured settings. Usage patterns will depend heavily on the specific configuration chosen (see the Configuration section).

## Configuration

Configuration options are available through the Drupal administration interface. Navigate to the module configuration page (path provided after enabling or via `admin/config` if a UI is added for configuration ).

Key configuration areas may include:

* **User Mapping:** Settings to map Drupal users to their Drupal.org accounts, potentially using the `do_username` module.
* **Tracking Scope:** Define the types of contributions to track (e.g., issue comments, code patches).
* **Reporting Frequency:** Schedule how often contribution data is updated.
* **Notification Settings:** Configure alerts or reports, potentially utilizing the `slack` module, on significant user contributions.

## API

This module provides the following services.

### Services

* `services`: This service provides methods for retrieving and processing contribution data for Drupal.org users. Further details on the API service should be found in the code within the `src/Service` directory.

## Examples

Practical examples of how to use the module:

* **Track a specific user's contributions:**

```php
// Example (Illustrative - this may not be exactly how it works)
$user_id = 123; // Drupal User ID
$contribution_data = \Drupal::service('services')->getUserContributions($user_id);

// Process the contribution data to display on a custom report or page.
```

* **Generate a report of top contributors:**

```php
// Example (Illustrative - this may not be exactly how it works)
$top_contributors = \Drupal::service('services')->getTopContributors(10);

// Display the names and contribution scores of the top 10 contributors.
```

**Note:** These examples are for illustrative purposes only. The specifics of interacting with services will depend on the underlying code implementation. Consult the module's code for concrete implementation details.

## Dependencies

This module relies on the following Drupal modules and third-party libraries:

* **hussainweb/drupal-api-client:** Used for interacting with the Drupal.org API.
* **drupal/do_username:** Used for linking Drupal user accounts with Drupal.org usernames.
* **drupal/slack:** Used for sending notifications to Slack channels.

Ensure these dependencies are installed and enabled before using this module. Use Composer to manage dependencies:

```bash
composer require hussainweb/drupal-api-client
composer require drupal/do_username
composer require drupal/slack
```

## Known Issues

* No known issues currently reported. Please report any issues you encounter in the issue queue on Drupal.org.

## Contributing

Contributions are welcome! Please follow these steps:

1. Fork the repository on Drupal.org.
2. Create a new branch for your feature or bug fix.
3. Implement your changes, adhering to Drupal coding standards.
4. Write tests for your changes.
5. Submit a merge request to the main repository.

## Changelog

### Version 1.0.0

* Initial release.
* Basic functionality for tracking Drupal.org contributions.

## License

This module is licensed under the [GPL-2.0-or-later](https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) license.
```
125 changes: 125 additions & 0 deletions docs/api-report/ct_github-README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
```markdown
# Github Contribution Tracker

## Description

This module tracks the contributions of users on GitHub. It leverages the GitHub API to gather data and provide insights into user activity.

## Installation

1. Clone the repository:
```bash
git clone <repository_url>
cd <repository_directory>
```

2. Install dependencies using Composer:
```bash
composer install
```

3. Configure the necessary environment variables (see Configuration).

## Usage

After installation, you can use the provided services to interact with the GitHub API and retrieve contribution data. See the `Examples` section for usage demonstrations.

## Configuration

This module requires a [GitHub personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens). The token needs `read:org` permissions if you intend to access private organizations.

Set the following environment variables:

* `GITHUB_TOKEN`: Your GitHub personal access token.

Example `.env` configuration:

```
GITHUB_TOKEN=ghp_your_github_token_here
```

## API

### Services

The module offers the following services:

* **`services`**: This endpoint gives you access to pre-defined functions which use the GitHub API.
* To use this API, import the service and inject the `GITHUB_TOKEN` as an environment variable.
* Example code:
```php
use ExampleNameSpace\GithubService;

$service = new GithubService($_ENV['GITHUB_TOKEN']);
$userContributions = $service->getUserContributions('github_username');
```
This function will retrieve public contribution events for the specific user.

### Routes

No routes are currently defined in this module. All interactions are handled through the provided services.

### Permissions

No specific permissions are defined within the module itself. However, ensure your GitHub personal access token has the necessary permissions for the data you intend to access (e.g., `read:org` for private organization data).

### Database Schema

Currently, this module does not utilize a database. Data is retrieved directly from the GitHub API.

## Examples

```php
<?php

require_once 'vendor/autoload.php';

// Load environment variables (using Dotenv for example)
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();

use Github\Client;

try {
$client = new Client();
$client->authenticate($_ENV['GITHUB_TOKEN'], null, Client::AUTH_ACCESS_TOKEN);
$username = 'octocat'; // Replace with the GitHub username you wish to query.
$events = $client->api('user')->events($username);
print_r($events);
} catch (Exception $e) {
echo "Error: " . $e->getMessage() . "\n";
}
```

## Dependencies

* [knplabs/github-api](https://github.com/KnpLabs/php-github-api): A PHP client library for the GitHub API. This dependency is managed through Composer.

## Known Issues

* Rate limiting: The GitHub API is subject to rate limits. Handle rate limit responses appropriately (e.g., by implementing retry mechanisms or caching).
* Error handling: Comprehensive error handling is essential to gracefully manage potential API errors (e.g., invalid tokens, network issues, resource not found).

## Contributing

Contributions are welcome! Please follow these steps:

1. Fork the repository.
2. Create a new branch for your feature or bug fix.
3. Implement your changes.
4. Write tests to ensure your changes are working correctly.
5. Submit a pull request.

## Changelog

* **v1.0.0 (YYYY-MM-DD)**: Initial release.
* Implemented basic service for retrieving user contributions.
* Added configuration options for GitHub token.

* **v1.0.1 (YYYY-MM-DD)**: Bug Fixes
* Fixed issue with authentication.

## License

This module is licensed under the [MIT License](LICENSE).
```
Loading