PhpStorm은 자동 코드 검사를 실행할 때마다 코드에 오류를 추가합니다. 내 들여 쓰기를 수정하기 때문에 커밋 할 때 사용하는 것이 좋습니다.PhpStorm : 식별자도 자동으로 인용 부호가 붙습니다.
여기에 전에 테스트 값을 내 코드의 커밋 : 커밋과 [괄호]로 모든 코드를 통해 세 개의 변수를 넣고, 자동 코드 스캔 실행이 여러 줄을 바꿀시키는
/**
* Calculates and selects the average score of a single user.
* This will also have to calculate the score in different criteria.
*/
DECLARE @Max_Grade INTEGER
SET @Max_Grade = 6
DECLARE @User_ID INTEGER
SET @User_ID = 16
DECLARE @Basic_Weight INTEGER
SET @Basic_Weight = 10
DECLARE @Daily_Weight FLOAT
SET @Daily_Weight = 0.5
-- Create temporary utility table.
-- This table will contain each appraisal and its maximum score vs. total score of all
-- questions.
DECLARE @Score_Table TABLE
(
[Appraisal_ID] INTEGER,
[Total_Score] FLOAT,
[Maximum_Score] FLOAT
)
INSERT INTO @Score_Table (
[Appraisal_ID],
[Total_Score],
[Maximum_Score]
) (
SELECT
[Appraisal].[Appraisal_ID] AS [Appraisal_ID]
, SUM(
[Question].[Grade] *
(
@Basic_Weight +
@Daily_Weight * DATEDIFF(DAY, [Plan].[From_Time], [Plan].[To_Time])
)
)
AS [Total_Score]
, SUM(
@Max_Grade *
(
@Basic_Weight +
@Daily_Weight * DATEDIFF(DAY, [Plan].[From_Time], [Plan].[To_Time])
)
)
AS [Maximum_Score]
FROM
[Question], [Appraisal], [Plan]
WHERE
[Question].[Grade] IS NOT NULL AND
[Question].[Grade] != 0 AND
[Appraisal].[Appraisal_ID] = [Question].[Appraisal_ID] AND
[Plan].[Plan_ID] = [Appraisal].[Plan_ID] AND
[Appraisal].[User_ID_Candidate] = @User_ID AND
[Appraisal].[Disabled] IS NULL AND
-- DONE Criterium: Only count those appraisals that are completed
[Appraisal].[Choice_Candidate] IS NOT NULL AND
[Appraisal].[Choice_Candidate] <> 0 AND
[Appraisal].[Choice_Owner] IS NOT NULL AND
[Appraisal].[Choice_Owner] <> 0
GROUP BY [Appraisal].[Appraisal_ID]
)
SELECT
NULL,
-- Calculate the end result by dividing the final results and multiplaying by maximum grade
(
SUM([Total_Score])/
SUM([Maximum_Score])
) * @Max_Grade
FROM @Score_Table
UNION
-- Select all grades as floats
SELECT
[Appraisal_ID],
-- Divide the actual weighted grade by the maximum weighted grade and multiply it by the maximum grade to get the
-- average score of each
-- appraisal.
-- Total Score:
[Total_Score]/
-- Divided by Maximum Score:
[Maximum_Score] * @Max_Grade
AS [Average_Grade]
FROM @Score_Table
-를 제외한 모든 발생 그들의 선언.
/**
* Calculates and selects the average score of a single user.
* This will also have to calculate the score in different criteria.
*/
DECLARE @Max_Grade INTEGER
SET @Max_Grade = 6
DECLARE @User_ID INTEGER
SET @User_ID = 16
DECLARE @Basic_Weight INTEGER
SET @Basic_Weight = 10
DECLARE @Daily_Weight FLOAT
SET @Daily_Weight = 0.5
-- Create temporary utility table.
-- This table will contain each appraisal and its maximum score vs. total score of all
-- questions.
DECLARE [@Score_Table] TABLE
(
[Appraisal_ID] INTEGER,
[Total_Score] FLOAT,
[Maximum_Score] FLOAT
)
INSERT INTO [@Score_Table] (
[Appraisal_ID],
[Total_Score],
[Maximum_Score]
) (
SELECT
[Appraisal].[Appraisal_ID] AS [Appraisal_ID]
, SUM(
[Question].[Grade] *
(
[@Basic_Weight] +
[@Daily_Weight] * DATEDIFF(DAY, [Plan].[From_Time], [Plan].[To_Time])
)
)
AS [Total_Score]
, SUM(
[@Max_Grade] *
(
[@Basic_Weight] +
[@Daily_Weight] * DATEDIFF(DAY, [Plan].[From_Time], [Plan].[To_Time])
)
)
AS [Maximum_Score]
FROM
[Question], [Appraisal], [Plan]
WHERE
[Question].[Grade] IS NOT NULL AND
[Question].[Grade] != 0 AND
[Appraisal].[Appraisal_ID] = [Question].[Appraisal_ID] AND
[Plan].[Plan_ID] = [Appraisal].[Plan_ID] AND
[Appraisal].[User_ID_Candidate] = @User_ID AND
[Appraisal].[Disabled] IS NULL AND
-- DONE Criterium: Only count those appraisals that are completed
[Appraisal].[Choice_Candidate] IS NOT NULL AND
[Appraisal].[Choice_Candidate] <> 0 AND
[Appraisal].[Choice_Owner] IS NOT NULL AND
[Appraisal].[Choice_Owner] <> 0
GROUP BY [Appraisal].[Appraisal_ID]
)
SELECT
NULL,
-- Calculate the end result by dividing the final results and multiplaying by maximum grade
(
SUM([Total_Score])/
SUM([Maximum_Score])
) * @Max_Grade
FROM @Score_Table
UNION
-- Select all grades as floats
SELECT
[Appraisal_ID],
-- Divide the actual weighted grade by the maximum weighted grade and multiply it by the maximum grade to get the
-- average score of each
-- appraisal.
-- Total Score:
[Total_Score]/
-- Divided by Maximum Score:
[Maximum_Score] * @Max_Grade
AS [Average_Grade]
FROM @Score_Table
@User_ID
을 제외한 모든 변수는 자동으로 인용됩니다. 불행하게도 스크립트는 변수의 일관성없는 인용 때문에 21, 77 및 95 행에서 중단됩니다. 나는 당신이 그들을 인용하면 당신도 그들을 선언 할 수 있다고 생각하지 않습니다.
이 기능은 IDE의 설정 및 프로젝트 기본 설정 모두에서 사용할 수 없습니다 :
나는 함께이 옵션을 사용하지 않고 코드 검사를 시도했습니다.
버전/소개 :
이사람이 올바른 방향으로 날 지점 수 있을까요? 자동 코드 검사에서 파일을 제외 할 수 있지만이 문제로 인해 여러 파일을 제외하기 전에 대체 솔루션을 듣고 싶습니다.
** 검사는보고있다 . 그래서 ... 이것은 가장 가능성있는 코드 스타일 설정 (IDE 또는 당신이 커밋하기 전에 코드 포맷을 실행할 수 있습니다)입니다 - 거기를 확인하십시오. – LazyOne
감사합니다. – RubbelDieKatz
답변을 게시했습니다. 팁 주셔서 감사! – RubbelDieKatz