Skip to content
Merged
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.clj-kondo/
.lsp/
.vscode/
.vscode/
*py_cache__/
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Changelog

Todas as mudanças notáveis neste projeto serão documentadas neste arquivo.

O formato é baseado em [Keep a Changelog](https://keepachangelog.com/pt-BR/1.0.0/),
e este projeto adere ao [Semantic Versioning](https://semver.org/lang/pt-BR/).

## [Não Lançado]

### Adicionado
- Templates de Issues (Bug Report e Feature Request)
- Template de Pull Request
- Guia de Contribuição (CONTRIBUTING.md)
- Workflow de CI/CD com GitHub Actions
- Testes unitários para gerador de senhas Python

Copilot AI Jan 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CHANGELOG references test file additions ("Testes unitários para gerador de senhas Python") that don't exist in this pull request. The workflow file references test_senha.py but this file is not included in the repository, making this changelog entry inaccurate.

Suggested change
- Testes unitários para gerador de senhas Python

Copilot uses AI. Check for mistakes.

### Melhorado
- Implementação completa do gerador de senhas em Python
- Adicionada validação de força de senha
- Adicionada função para gerar múltiplas senhas

## [1.0.0] - 2026-01-04

### Adicionado
- Coleção inicial de projetos (iniciante, intermediário, avançado)
- README principal com descrição dos projetos
- Implementação JavaScript do gerador de senhas
- Implementação Python do gerador de senhas

[Não Lançado]: https://github.com/Ryanditko/coding-projects-library/compare/v1.0.0...HEAD
[1.0.0]: https://github.com/Ryanditko/coding-projects-library/releases/tag/v1.0.0
61 changes: 61 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Guia de Contribuição

Obrigado por considerar contribuir para a Projects Library! 🎉

## Como Contribuir

### 1. Reportar Issues
- Descreva o problema claramente
- Inclua passos para reproduzir
- Mencione o ambiente (OS, versão do Python/Node, etc.)

### 2. Sugerir Melhorias
- Abra uma issue descrevendo a melhoria
- Explique o benefício da mudança
- Discuta possíveis implementações

### 3. Pull Requests
- Faça fork do repositório
- Crie uma branch para sua feature (`git checkout -b feature/MinhaFeature`)
- Commit suas mudanças (`git commit -m 'Adiciona MinhaFeature'`)
- Push para a branch (`git push origin feature/MinhaFeature`)
- Abra um Pull Request

### 4. Code Review
- Revise PRs abertos
- Forneça feedback construtivo
- Sugira melhorias no código
- Teste as mudanças propostas

## Padrões de Código

### Python
- Siga PEP 8
- Use docstrings
- Adicione testes quando possível

### JavaScript
- Use ESLint
- Comente código complexo
- Mantenha funções pequenas e focadas

## Estrutura dos Projetos

Cada projeto deve ter:
- README.md com descrição e instruções
- Código bem documentado
- Exemplos de uso

## Processo de Review

1. Todo PR será revisado por pelo menos um maintainer
2. Feedback será fornecido em até 48 horas
3. Mudanças solicitadas devem ser implementadas
4. Após aprovação, o PR será merged

## Dúvidas?

Abra uma issue com a tag `question` ou entre em contato!

---
**Obrigado pela sua contribuição!**
37 changes: 37 additions & 0 deletions iniciante/calculadora-simples/script.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
(ns iniciante.calculadora-simples.script
(:require [clojure.string :as str]))

(defn tokenize [expr]
(->> expr
(str/replace " " "")
(re-seq #"\d+(\.\d+)?|[+\-*/]")
(map #(if (re-matches #"\d+(\.\d+)?" %)
(Double/parseDouble %)
(first %)))))

(defn resolve-high-precedence [tokens]
(loop [result []
[t & more] tokens]
(if (nil? t)
result
(if (#{\* \/} t)
(let [prev (peek result)
next (first more)
calc (if (= t \*)
(* prev next)
(/ prev next))]

Copilot AI Jan 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Division by zero is not explicitly handled in the calculator logic. When dividing by zero, Clojure will throw an ArithmeticException. Consider adding validation to check if the divisor is zero and provide a user-friendly error message.

Suggested change
(/ prev next))]
(if (zero? next)
(throw (IllegalArgumentException. "Division by zero is not allowed."))
(/ prev next)))]

Copilot uses AI. Check for mistakes.
(recur (conj (pop result) calc) (rest more)))
(recur (conj result t) more)))))

(defn resolve-low-precedence [tokens]
(loop [acc (first tokens)
[op n & more] (rest tokens)]
(if (nil? op)
acc
(recur (case op
\+ (+ acc n)
\- (- acc n))
more))))

(defn calcular [expr]
(-> expr tokenize resolve-high-precedence resolve-low-precedence))
89 changes: 89 additions & 0 deletions iniciante/calculadora-simples/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// --- Função para transformar a string em tokens (números e operadores) ---
function tokenize(expr) {
const tokens = [];
let current = '';

for (let char of expr) {
if (/[0-9.]/.test(char)) { // número ou ponto decimal
current += char;
} else if (/[+\-*/]/.test(char)) { // operador
if (current) tokens.push(parseFloat(current));
tokens.push(char);
current = '';
}
}
if (current) tokens.push(parseFloat(current));
return tokens;
}

// --- Resolve operações de alta precedência: * e / ---
function resolveHighPrecedence(tokens) {
const result = [];
let i = 0;

while (i < tokens.length) {
const token = tokens[i];

if (token === '*' || token === '/') {
const prev = result.pop();
const next = tokens[i + 1];

Copilot AI Jan 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Division by zero is not explicitly handled in the calculator logic. While the main loop catches generic errors, division by zero will result in Infinity in JavaScript, which may not be the desired behavior. Consider adding explicit validation when the divisor is zero to provide a clearer error message to users.

Suggested change
const next = tokens[i + 1];
const next = tokens[i + 1];
if (token === '/' && next === 0) {
throw new Error("Divisão por zero");
}

Copilot uses AI. Check for mistakes.
const calc = token === '*'
? prev * next
: prev / next;

result.push(calc);
Comment on lines +30 to +34

Copilot AI Jan 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable 'calc' is not descriptive and should be renamed to something more meaningful like 'result' or 'calculatedValue' to improve code readability and maintainability.

Suggested change
const calc = token === '*'
? prev * next
: prev / next;
result.push(calc);
const calculatedValue = token === '*'
? prev * next
: prev / next;
result.push(calculatedValue);

Copilot uses AI. Check for mistakes.
i += 2; // pulamos o próximo porque já calculamos
} else {
result.push(token);
i++;
}
}

return result;
}

// --- Resolve baixa precedência: + e - ---
function resolveLowPrecedence(tokens) {
let result = tokens[0];

for (let i = 1; i < tokens.length; i += 2) {
const operator = tokens[i];
const next = tokens[i + 1];

if (operator === '+') result += next;
if (operator === '-') result -= next;
}

return result;
}

// --- Função principal que junta tudo ---
function calcular(expressao) {
const tokens = tokenize(expressao);
const etapa1 = resolveHighPrecedence(tokens);
const resultado = resolveLowPrecedence(etapa1);
return resultado;
}

// --- CLI ---
const readline = require("readline").createInterface({
input: process.stdin,
output: process.stdout
});

console.log("Calculadora Simples | digite expressões como: 12+7*3-4/2");
console.log("Para sair, pressione CTRL + C\n");

function loop() {
readline.question("> ", (input) => {
try {
const resultado = calcular(input);
console.log("= " + resultado + "\n");
} catch (e) {
console.log("Erro na expressão\n");
}
loop(); // mantém a calculadora ativa
});
}

loop();
88 changes: 88 additions & 0 deletions iniciante/calculadora-simples/script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import re

Comment on lines +1 to +2

Copilot AI Jan 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 're' is not used.

Suggested change
import re

Copilot uses AI. Check for mistakes.
# --- Tokenização: transforma expressão em números e operadores ---
def tokenize(expr):
tokens = []
current = ''

for char in expr.replace(" ", ""): # remove espaços
if char.isdigit() or char == '.':
current += char
elif char in '+-*/':
if current:
tokens.append(float(current))
tokens.append(char)
current = ''
else:
raise ValueError(f"Caractere inválido: {char}")

if current:
tokens.append(float(current))
return tokens


# --- Resolve operações de alta precedência: * e / ---
def resolve_high_precedence(tokens):
result = []
i = 0

while i < len(tokens):
token = tokens[i]

if token in ('*', '/'):
prev = result.pop()
next_value = tokens[i + 1]

calc = prev * next_value if token == '*' else prev / next_value
result.append(calc)
Comment on lines +36 to +37

Copilot AI Jan 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable 'calc' is not descriptive and should be renamed to something more meaningful like 'result' or 'calculated_value' to improve code readability and maintainability.

Suggested change
calc = prev * next_value if token == '*' else prev / next_value
result.append(calc)
calculated_value = prev * next_value if token == '*' else prev / next_value
result.append(calculated_value)

Copilot uses AI. Check for mistakes.
i += 2
else:
result.append(token)
i += 1

return result


# --- Resolve baixa precedência: + e - ---
def resolve_low_precedence(tokens):
result = tokens[0]

for i in range(1, len(tokens), 2):
operator = tokens[i]
next_value = tokens[i + 1]

if operator == '+':
result += next_value
elif operator == '-':
result -= next_value

return result


# --- Função principal ---
def calcular(expressao):
tokens = tokenize(expressao)
etapa1 = resolve_high_precedence(tokens)
resultado = resolve_low_precedence(etapa1)
return resultado


# --- CLI / Loop principal ---
if __name__ == "__main__":
print("Calculadora CLI Simples | digite expressões como: 12+7*3-4/2")
print("Para sair use CTRL + C\n")

while True:
try:
entrada = input("> ")
if entrada.strip() == "":
continue

resultado = calcular(entrada)
print(f"= {resultado}\n")

except ZeroDivisionError:
print("Erro: divisão por zero não é permitida.\n")

except Exception as e:
print(f"Erro: {e}\n")
Loading