Skip to content
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

feat: update var names #17

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Reviewer } from './reviewer';
import { Options as Config } from './options';
import { cliCanRun } from './utils';

Choose a reason for hiding this comment

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

The variable name 'o' is not descriptive. Consider using a more descriptive name for the type, such as 'CliOptions'.

type CliOptions = {
type o = {
pr: number;
repository: string;
owner: string;
Expand All @@ -20,7 +20,7 @@ type CliOptions = {
.requiredOption('-r, --repository <string>', 'Repository name to review')
.requiredOption('-o, --owner <string>', 'Repository owner')
.addOption(new Option('-m, --model <string>', 'OpenAI GPT model to use').choices(['gpt-3.5-turbo', 'gpt-4']).makeOptionMandatory(true))

Choose a reason for hiding this comment

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

The variable name 'o' is not descriptive. Consider using a more descriptive name for the type, such as 'CliOptions'.

.action(async (options: CliOptions) => {
.action(async (options: o) => {
if(cliCanRun()) {
const config = new Config({
openaiApiBaseUrl: 'https://api.openai.com/v1',
Expand Down
8 changes: 4 additions & 4 deletions src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ export const SUPPORTED_ACTIONS = ['opened', 'labeled'];
export const SUPPORTED_FILE_EXTENSIONS = ['.js', '.ts', '.py', '.java'];

export class Options {

Choose a reason for hiding this comment

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

The variable names 'openai_Api_Key' and 'openai_Api_Base_Url' do not follow the camelCase naming convention typically used in JavaScript. Consider renaming them to 'openaiApiKey' and 'openaiApiBaseUrl' respectively.

openaiApiKey: string;
openaiApiBaseUrl: string;
openai_Api_Key: string;
openai_Api_Base_Url: string;
openaiModel: 'gpt-4' | 'gpt-3.5-turbo';

constructor(params: {
openaiApiBaseUrl: string;
openaiModel: string;
}) {
this.openaiApiKey = process.env.OPENAI_API_KEY!;
this.openaiApiBaseUrl = params.openaiApiBaseUrl;
this.openai_Api_Key = process.env.OPENAI_API_KEY!;
this.openai_Api_Base_Url = params.openaiApiBaseUrl;
this.openaiModel = Options.parseGptModel(params.openaiModel);
}

Expand Down
2 changes: 1 addition & 1 deletion src/reviewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class Reviewer {

constructor(options: Options) {
this.options = options;
const model = createOpenAILanguageModel(options.openaiApiKey, options.openaiModel);
const model = createOpenAILanguageModel(options.openai_Api_Key, options.openaiModel);

Choose a reason for hiding this comment

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

The variable name 'openai_Api_Key' does not follow the camelCase naming convention. Consider renaming it to 'openaiApiKey'.

const schema = fs.readFileSync(path.join(__dirname, 'commentArraySchema.ts'), 'utf8');
this.translator = createJsonTranslator<CommentArraySchema>(model, schema, 'CommentArraySchema');
}
Expand Down