Skip to content

Commit

Permalink
Merge pull request #28 from salihozkara/salihozkara/refactoring
Browse files Browse the repository at this point in the history
Salihozkara/refactoring
  • Loading branch information
salihozkara authored Jan 14, 2023
2 parents fb9a565 + 48af44a commit 4592757
Show file tree
Hide file tree
Showing 45 changed files with 564 additions and 380 deletions.
28 changes: 20 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
# MetricHunter

MetricHunter is a tool that allows developers to find and explore popular repositories on GitHub. It allows developers to search for repositories based on language or topic, and provides information about the activity and success of the repository.
MetricHunter is a tool that allows developers to find and explore popular repositories on GitHub. It allows developers
to search for repositories based on language or topic, and provides information about the activity and success of the
repository.

Using MetricHunter, developers can clone the repositories they are interested in, which allows them to explore the code and learn from other developers in their field. MetricHunter also provides metrics about the repository, such as the number of stars and forks it has received, which can give developers an idea of the popularity and activity of the project.
Using MetricHunter, developers can clone the repositories they are interested in, which allows them to explore the code
and learn from other developers in their field. MetricHunter also provides metrics about the repository, such as the
number of stars and forks it has received, which can give developers an idea of the popularity and activity of the
project.

In addition to these features, MetricHunter also allows developers to make predictions about the success of projects based on the metrics and other factors. This can help developers stay informed about which projects are likely to be successful in the future and potentially contribute to or use those projects.
In addition to these features, MetricHunter also allows developers to make predictions about the success of projects
based on the metrics and other factors. This can help developers stay informed about which projects are likely to be
successful in the future and potentially contribute to or use those projects.

Overall, MetricHunter is a useful tool for developers who want to stay up-to-date on the most popular and successful repositories on GitHub, and learn from the experiences of other developers.
Overall, MetricHunter is a useful tool for developers who want to stay up-to-date on the most popular and successful
repositories on GitHub, and learn from the experiences of other developers.

## Getting Started

Expand All @@ -25,11 +33,15 @@ Overall, MetricHunter is a useful tool for developers who want to stay up-to-dat

* **Search:** Allows developers to search for repositories on GitHub based on language or topic.

* **Cloning:** Enables developers to clone repositories they are interested in, allowing them to explore the code and learn from other developers.
* **Cloning:** Enables developers to clone repositories they are interested in, allowing them to explore the code and
learn from other developers.

* **Metrics:** Provides information about the activity and success of a repository, such as the number of stars and forks it has received.
* **Metrics:** Provides information about the activity and success of a repository, such as the number of stars and
forks it has received.

* **Predictions:** Allows developers to make predictions about the success of projects based on metrics and other factors.
* **Predictions:** Allows developers to make predictions about the success of projects based on metrics and other
factors.

* **Learning resources:** Offers a range of resources and learning materials to help developers improve their skills and stay up-to-date on the latest developments in their field.
* **Learning resources:** Offers a range of resources and learning materials to help developers improve their skills and
stay up-to-date on the latest developments in their field.

18 changes: 14 additions & 4 deletions doc/Roadmap.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
# Roadmap

The following is a roadmap for the development of MetricHunter:

## Priority 1: Improve search functionality

* Add advanced search options, such as the ability to search by date range or by specific users
* Improve the accuracy and relevance of search results

## Priority 2: Enhance repository metrics
* Add new metrics, such as the number of contributors to a repository or the number of issues that have been opened and closed
*

* Add new metrics, such as the number of contributors to a repository or the number of issues that have been opened and
closed
*

## Priority 3: Add collaboration features

* Add tools for team communication and project management, such as kanban boards and project milestones

## Priority 4: Expand learning resources
* Add more tutorials, articles, and other resources to help developers improve their skills and stay up-to-date on the latest developments in their field

* Add more tutorials, articles, and other resources to help developers improve their skills and stay up-to-date on the
latest developments in their field

## Priority 5: Improve user experience

* Redesign the user interface to make it more intuitive and user-friendly
* Add new features to make it easier for developers to find and explore repositories on GitHub

This roadmap is subject to change based on the goals and priorities of the MetricHunter project. However, these are the key areas that MetricHunter will focus on in order to continue improving and evolving as a tool for developers.
This roadmap is subject to change based on the goals and priorities of the MetricHunter project. However, these are the
key areas that MetricHunter will focus on in order to continue improving and evolving as a tool for developers.
65 changes: 47 additions & 18 deletions doc/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,34 @@

## Introduction

Welcome to the MetricHunter user guide! MetricHunter is a tool that allows developers to find and explore popular repositories on GitHub. With MetricHunter, you can search for repositories based on language or topic, clone repositories to your local machine, view repository metrics, make predictions about the success of projects, and collaborate with other developers.
Welcome to the MetricHunter user guide! MetricHunter is a tool that allows developers to find and explore popular
repositories on GitHub. With MetricHunter, you can search for repositories based on language or topic, clone
repositories to your local machine, view repository metrics, make predictions about the success of projects, and
collaborate with other developers.

In this user guide, you will learn how to install and set up MetricHunter, authenticate with your GitHub account, search for and clone repositories, view repository metrics, make predictions, and access learning resources and community support.

Whether you are new to MetricHunter or an experienced user, this guide will provide you with the information you need to get the most out of the tool. So let's get started!
In this user guide, you will learn how to install and set up MetricHunter, authenticate with your GitHub account, search
for and clone repositories, view repository metrics, make predictions, and access learning resources and community
support.

Whether you are new to MetricHunter or an experienced user, this guide will provide you with the information you need to
get the most out of the tool. So let's get started!

## Installation

Go to MetricHunter [releases page](https://github.com/salihozkara/MetricHunter/releases), click on Assets at the bottom to show the files available in the release. Please use the appropriate the MetricHunter installer that matches your machine's architecture. For most, it is x64.
Go to MetricHunter [releases page](https://github.com/salihozkara/MetricHunter/releases), click on Assets at the bottom
to show the files available in the release. Please use the appropriate the MetricHunter installer that matches your
machine's architecture. For most, it is x64.

After downloading the installer, run it. Once the installation is complete, you can launch MetricHunter from the Start menu.
After downloading the installer, run it. Once the installation is complete, you can launch MetricHunter from the Start
menu.

## Overview

![MetricHunter Overview](images/overview.png)

### Search Button

The search button in MetricHunter allows you to search for repositories based on language, topic.
The search button in MetricHunter allows you to search for repositories based on language, topic.

### Download Button

Expand All @@ -33,40 +41,61 @@ The calculate metrics button in MetricHunter allows you to calculate metrics of

### Hunt Button

The hunt button is special button in MetricHunter. It is combination of download and calculate metrics buttons. It allows you to download projects and calculate metrics of them in one click. After completing the operations, it deletes the repositories and frees up storage.
The hunt button is special button in MetricHunter. It is combination of download and calculate metrics buttons. It
allows you to download projects and calculate metrics of them in one click. After completing the operations, it deletes
the repositories and frees up storage.

### Save Search Results

The save search results button in MetricHunter allows you to save the search results you get. (Like add a favourite.) The repositories are save to json file. You can load them later. If you have an existing json file, you can add new repositories to it.
The save search results button in MetricHunter allows you to save the search results you get. (Like add a favourite.)
The repositories are save to json file. You can load them later. If you have an existing json file, you can add new
repositories to it.

### Load Repositories

The load repositories button in MetricHunter allows you to load repositories you saved.

### Inputs

* **Topics:** Topics are used to help developers find and explore repositories on GitHub that are related to a specific subjects or theme. For example, a developer who is interested in Learning about Android development might search for repositories with the topic "android".
* **Wanted Count:** Wanted count allows developers to specify the number of repositories they want to retrieve when using the tool. For example, if a developer wants to search for repositories with the topic "android" and wants to retrieve 10 repositories, they would enter "android" in the topics input and "10" in the wanted count input.
* **Language:** Language is used to help developers find and explore repositories on GitHub that are written in a specific programming language. For example, a developer who is interested in learning about Android development might search for repositories written in Java.
* **Sort by:** Sort by allows developers to specify how they want to sort the repositories they retrieve when using the tool. For example, if a developer wants to search for repositories with the topic "android" and wants to retrieve 10 repositories, they would enter "android" in the topics input, "10" in the wanted count input, and "stars" in the sort by input. This would retrieve the 10 repositories with the most stars that have the topic "android".
* **Topics:** Topics are used to help developers find and explore repositories on GitHub that are related to a specific
subjects or theme. For example, a developer who is interested in Learning about Android development might search for
repositories with the topic "android".
* **Wanted Count:** Wanted count allows developers to specify the number of repositories they want to retrieve when
using the tool. For example, if a developer wants to search for repositories with the topic "android" and wants to
retrieve 10 repositories, they would enter "android" in the topics input and "10" in the wanted count input.
* **Language:** Language is used to help developers find and explore repositories on GitHub that are written in a
specific programming language. For example, a developer who is interested in learning about Android development might
search for repositories written in Java.
* **Sort by:** Sort by allows developers to specify how they want to sort the repositories they retrieve when using the
tool. For example, if a developer wants to search for repositories with the topic "android" and wants to retrieve 10
repositories, they would enter "android" in the topics input, "10" in the wanted count input, and "stars" in the sort
by input. This would retrieve the 10 repositories with the most stars that have the topic "android".

## GitHub Authentication

It is generally not possible to use MetricHunter without authenticating with a GitHub account. This is because the GitHub API, which MetricHunter relies on to access and retrieve information about repositories on the platform, requires authentication in order to access the API.
It is generally not possible to use MetricHunter without authenticating with a GitHub account. This is because the
GitHub API, which MetricHunter relies on to access and retrieve information about repositories on the platform, requires
authentication in order to access the API.

Authenticating with a GitHub account allows MetricHunter to increase its rate limit, which is the number of requests that can be made to the API within a certain timeframe. Without authentication, MetricHunter would have a much lower rate limit, which could limit the functionality of the tool.
Authenticating with a GitHub account allows MetricHunter to increase its rate limit, which is the number of requests
that can be made to the API within a certain timeframe. Without authentication, MetricHunter would have a much lower
rate limit, which could limit the functionality of the tool.

It is generally not recommended to use MetricHunter without authenticating with a GitHub account, as this could significantly limit the functionality of the tool.
It is generally not recommended to use MetricHunter without authenticating with a GitHub account, as this could
significantly limit the functionality of the tool.

### How to Authenticate

To authenticate with a GitHub account, click on the "Authenticate" button in the top right corner of the MetricHunter window. This will open a new window in your default browser, where you can log in to your GitHub account and grant MetricHunter access to your account.
To authenticate with a GitHub account, click on the "Authenticate" button in the top right corner of the MetricHunter
window. This will open a new window in your default browser, where you can log in to your GitHub account and grant
MetricHunter access to your account.

Token is saved in your local machine. So you don't need to authenticate again.

![Authenticate](images/authenticate.png)

To use a GitHub token with MetricHunter, you will need to create a personal access token in your GitHub account and provide it to MetricHunter when prompted. You can do this by following these steps:
To use a GitHub token with MetricHunter, you will need to create a personal access token in your GitHub account and
provide it to MetricHunter when prompted. You can do this by following these steps:

* Sign in to your GitHub account and navigate to the "**Settings**" page.

Expand Down
6 changes: 3 additions & 3 deletions src/MetricHunter.Application.Shared/Git/GitConsts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace MetricHunter.Application.Git;
public static class GitConsts
{
public const string RepositoryInfoFileExtension = ".githunterinfo";
public static Dictionary<string,Language> LanguagesMap = new()

public static readonly Dictionary<string, Language> LanguagesMap = new()
{
{ "C#", Language.CSharp },
{ "C++", Language.CPlusPlus },
Expand All @@ -16,6 +16,6 @@ public static class GitConsts
{ "Python", Language.Python },
{ "Ruby", Language.Ruby },
{ "TypeScript", Language.TypeScript },
{ "Shell", Language.Shell },
{ "Shell", Language.Shell }
};
}
13 changes: 10 additions & 3 deletions src/MetricHunter.Application.Shared/Git/IGitManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,21 @@ public interface IGitManager
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task<GitOutput> GetRepositories(GitInput input);
Task<GitOutput> GetRepositoriesAsync(GitInput input);

/// <summary>
/// Returns the repository visibility
/// </summary>
/// <param name="repository"></param>
/// <returns></returns>
Task<bool> IsRepositoryPublicAsync(Repository repository);

/// <summary>
/// Reruns failed requests
/// </summary>
/// <param name="failedRequests"></param>
/// <returns></returns>
Task<GitOutput> RetryFailedRequest(List<SearchRepositoriesRequest> failedRequests);
Task<GitOutput> RetryFailedRequestAsync(List<SearchRepositoriesRequest> failedRequests);

/// <summary>
/// This event is triggered when a request fails.
Expand All @@ -50,4 +57,4 @@ public interface IGitManager
/// This event is triggered when there is an unknown error in a request.
/// </summary>
event EventHandler<ExceptionEventArgs>? OnException;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\MetricHunter.Core.Shared\MetricHunter.Core.Shared.csproj" />
<ProjectReference Include="..\MetricHunter.Core.Shared\MetricHunter.Core.Shared.csproj"/>
</ItemGroup>

<ItemGroup>
<PackageReference Include="JsonNet.ContractResolvers" Version="2.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Octokit" Version="4.0.3" />
<PackageReference Include="JsonNet.ContractResolvers" Version="2.0.0"/>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2"/>
<PackageReference Include="Octokit" Version="4.0.3"/>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ namespace MetricHunter.Application.Metrics;

public interface IMetricCalculator : ISingletonDependency
{
Task<IResult>? CalculateMetricsAsync(Repository repository, CancellationToken token = default);
Task<IResult> CalculateMetricsAsync(Repository repository, CancellationToken token = default);

Task<IResult?[]> CalculateMetricsByLocalResultsAsync(List<Repository> repositories,
CancellationToken token = default);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ public interface IMetricCalculatorManager
{
IMetricCalculator FindMetricCalculator(Language language);

Language[] GetSupportedLanguages();
IEnumerable<Language> GetSupportedLanguages();
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace MetricHunter.Application.Metrics;

[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public class LanguageAttribute : Attribute
{
public LanguageAttribute(params Language[] languages)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@

public interface ISourceMonitorMetric : IMetric
{
static IReadOnlyList<string> MatchedMetricNames { get; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ namespace MetricHunter.Application.Repositories;
public interface IRepositoryAppService
{
Task<Repository[]> ReadRepositories(string path);

Task WriteRepositories(IEnumerable<Repository> repositories, string path);
}
2 changes: 1 addition & 1 deletion src/MetricHunter.Application.Shared/Resources/Resource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
using System.Dynamic;
using System.Globalization;
using System.Reflection;
using MetricHunter.Core.Helpers;
using JsonNet.ContractResolvers;
using MetricHunter.Core.Helpers;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Octokit;
Expand Down
2 changes: 2 additions & 0 deletions src/MetricHunter.Application.Shared/Results/IResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ public interface IResult
Dictionary<string, string> ToDictionary();

List<Dictionary<string, string>> ToDictionaryListByTopics();

bool IsEmpty();
}
19 changes: 19 additions & 0 deletions src/MetricHunter.Application.Shared/Results/NullResult.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace MetricHunter.Application.Results;

public class NullResult : IResult
{
public Dictionary<string, string> ToDictionary()
{
return new Dictionary<string, string>();
}

public List<Dictionary<string, string>> ToDictionaryListByTopics()
{
return new List<Dictionary<string, string>>();
}

public bool IsEmpty()
{
return true;
}
}
Loading

0 comments on commit 4592757

Please sign in to comment.