Skip to content

Commit

Permalink
Add code examples
Browse files Browse the repository at this point in the history
  • Loading branch information
rafed committed Nov 5, 2024
1 parent a24dc9d commit e455b8c
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 626 deletions.
42 changes: 0 additions & 42 deletions .github/workflows/hugo.yml

This file was deleted.

7 changes: 1 addition & 6 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ on:
push:
branches:
- main

# permissions:
# contents: read
# pages: write
# id-token: write


jobs:
build-deploy:
runs-on: ubuntu-latest
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@ dist/
website/

## hugo static/api for typedoc outputs
site/static/api/
site/static/api/
site/hugo_stats.json
71 changes: 41 additions & 30 deletions site/content/docs/overview/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,44 @@ date: 2024-02-17
weight: 10
---

## Quick Start from Template

{{% steps %}}

### Initialize a new site

[Click to copy the template on GitHub](https://github.com/new?template_name=theme-documentation&template_owner=HugoBlox)

### Configure your new site

[Configure your site name, description, and menu.](https://docs.hugoblox.com/tutorial/blog/)

### Add your content

[Edit the homepage and add your documentation pages.](https://docs.hugoblox.com/tutorial/blog/)

### Publish your site

[Easily publish your site for free with GitHub Pages](https://docs.hugoblox.com/tutorial/blog/)

{{% /steps %}}

## Next

Let's customize your new site:

{{< cards >}}
{{< card url="../guide/project-structure" title="Project Structure" icon="document-duplicate" >}}
{{< card url="../guide/configuration" title="Configuration" icon="adjustments-vertical" >}}
{{< /cards >}}
## Class based api

```ts
import { ParseSource } from "../codemetrica/ParseSource";
import { CyclomaticComplexity } from "../codemetrica/metrics"
import { GodClass } from "../codemetrica/smells"

const pyFile = ParseSource.fromFileSync("test.py");

for (const cls of pyFile.getClasses()) {
console.log(c.name);
if(GodClass.detect(cls)){
console.log(cls.name + " is a god class.")
}

for(const m of cls.getMethods()) {
console.log(m.name + ": " + CyclomaticComplexity.calculate(m));
}
}
```

## Functional API

```ts
import { ParseSource } from "../codemetrica/ParseSource";
import { detectCyclomaticComplexity } from "../codemetrica/metrics"
import { detectGodClass } from "../codemetrica/smells"

const pyFile = ParseSource.fromFileSync("test.py");

for (const cls of pyFile.getClasses()) {
console.log(c.name);
if(detectGodClass(cls)){
console.log(cls.name + " is a god class.")
}

for(const m of cls.getMethods()) {
console.log(m.name + ": " + calculateCyclomaticComplexity(m));
}
}
```
Loading

0 comments on commit e455b8c

Please sign in to comment.